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


Groups > comp.lang.php > #9946

Re: page "hit" counter

From Scott Johnson <noonehome@chalupasworld.com>
Newsgroups comp.lang.php
Subject Re: page "hit" counter
Date 2013-06-28 16:36 -0700
Organization A noiseless patient Spider
Message-ID <kql6bb$4sh$1@dont-email.me> (permalink)
References <mdgl5xtqjxxk.10i5pahhaubg$.dlg@40tude.net> <kql5ev$nea$1@news.albasani.net>

Show all headers | View raw


On 6/28/2013 4:16 PM, David Robley wrote:
> 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";
>>
>> ?>
>
> Read the documentation for mysql_query again especially the arguments.
>
> Note that the mysql_* functions are deprecated and you should consider using
> mysqli_* - see the warning at the top of the documentation page.
>

David

As i had to learn, Richard will not take notes or read manuals.  He has 
been warned numerous times to switch to mysqli and in particular how to 
use the mysql_query function previously.

Just so you do not get frustrated.

Scotty

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