Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #9940 > unrolled thread
| Started by | richard <noreply@example.com> |
|---|---|
| First post | 2013-06-28 18:46 -0400 |
| Last post | 2013-06-29 00:31 +0000 |
| Articles | 7 — 5 participants |
Back to article view | Back to comp.lang.php
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
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-06-28 18:46 -0400 |
| Subject | page "hit" counter |
| Message-ID | <mdgl5xtqjxxk.10i5pahhaubg$.dlg@40tude.net> |
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";
?>
[toc] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-06-28 19:00 -0400 |
| Message-ID | <kql47v$pog$1@dont-email.me> |
| In reply to | #9940 |
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
==================
[toc] | [prev] | [next] | [standalone]
| From | David Robley <me@home.invalid> |
|---|---|
| Date | 2013-06-29 08:46 +0930 |
| Message-ID | <kql5ev$nea$1@news.albasani.net> |
| In reply to | #9940 |
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.
--
Cheers
David Robley
Useless Invention: Waterproof teabags.
[toc] | [prev] | [next] | [standalone]
| From | Scott Johnson <noonehome@chalupasworld.com> |
|---|---|
| Date | 2013-06-28 16:36 -0700 |
| Message-ID | <kql6bb$4sh$1@dont-email.me> |
| In reply to | #9943 |
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
[toc] | [prev] | [next] | [standalone]
| From | David Robley <me@home.invalid> |
|---|---|
| Date | 2013-06-29 09:21 +0930 |
| Message-ID | <kql7i1$qi2$1@news.albasani.net> |
| In reply to | #9946 |
Scott Johnson wrote:
> 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
Thanks - I've seen previous dialogues with OP. Or perhaps that should be
monologues :-)
--
Cheers
David Robley
REALITY.SYS corrupted: Reboot universe? (Y/N/A)
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-06-28 19:31 -0400 |
| Message-ID | <1909yclbcikmq$.e6scq3nkhlr1.dlg@40tude.net> |
| In reply to | #9940 |
On Fri, 28 Jun 2013 18:46:16 -0400, 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";
>
> ?>
Heh.
Found a script on youtube that does the job I want.
http://www.youtube.com/watch?v=7DBUURqdUv4
[toc] | [prev] | [next] | [standalone]
| From | "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> |
|---|---|
| Date | 2013-06-29 00:31 +0000 |
| Message-ID | <kql9tl$ien$1@dont-email.me> |
| In reply to | #9945 |
richard the sto0pid wrote: > Heh. > Found a script on youtube that does the job I want. Lucky you, because you've never ever written a script of your own in your life. -- -bts -This space for rent, but the price is high
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web