Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #9942

Re: page "hit" counter

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: page "hit" counter
Date 2013-06-28 19:00 -0400
Organization A noiseless patient Spider
Message-ID <kql47v$pog$1@dont-email.me> (permalink)
References <mdgl5xtqjxxk.10i5pahhaubg$.dlg@40tude.net>

Show all headers | View raw


On 6/28/2013 6:46 PM, richard wrote:
> I am attempting to create a simple hit counter so I know how many times the
> page was actually viewed.
> The table is a simple 3 column deal.
> 1) id (key)
> 2) name
> 3) hits
>
>
> the code I have tried below returns the following error:
> Warning: mysql_query(): supplied argument is not a valid MySQL-Link
> resource
>
> What do I need to do to make this work right?
>
>
> <?php
> $con = mysql_connect('localhost','user','pass');
> if (!$con){die("can not connect: " . mysql_error());}
> mysql_select_db('richbull_top100',$con);
>
> mysql_query($con,"UPDATE counter1 SET hits=hits++
> WHERE name='pickhit' ");
>
> mysql_close($con);
>
> echo "done";
>
> ?>
>

Look up the mysql_query() function in the doc.


-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

page "hit" counter richard <noreply@example.com> - 2013-06-28 18:46 -0400
  Re: page "hit" counter Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-28 19:00 -0400
  Re: page "hit" counter David Robley <me@home.invalid> - 2013-06-29 08:46 +0930
    Re: page "hit" counter Scott Johnson <noonehome@chalupasworld.com> - 2013-06-28 16:36 -0700
      Re: page "hit" counter David Robley <me@home.invalid> - 2013-06-29 09:21 +0930
  Re: page "hit" counter richard <noreply@example.com> - 2013-06-28 19:31 -0400
    Re: page "hit" counter "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2013-06-29 00:31 +0000

csiph-web