Jump to content

[SOLVED] Troubles With My Hit Counter


phpQuestioner

Recommended Posts

I am having having problem with my hit count. I only have one row in my table; so I am not sure how I would use the "where" at the end of my mysql_query update.

 

 

<?php

mysql_connect("localhost","username","password");

mysql_select_db("database");

mysql_query("UPDATE mytable SET myrow=myrow+1");

?>

Link to comment
https://forums.phpfreaks.com/topic/68542-solved-troubles-with-my-hit-counter/
Share on other sites

Lol. No offense but you made a pretty funny mistake.  ;D ;D ;D ;D

 

You need to have an id fieldname that has value of "1". You must use it to pin point which row you want to update.

 

then do what you did with the mysql query but set where id='1'. But first you need to create that fieldname. Hope that helps.

 

I'm a noob.

yeah - ok - i did that - but it still is not updating

 

<?php
mysql_query("UPDATE mytable SET myrow=myrow+1 WHERE number='1'");
?>

 

"number"? ???

 

If you knew a tad bit of mysql and about php you should call that fieldname "id," with auto increment.

TheFilmGod - I know enough to do what I need to do and I always am continuously learning new things; just as most PHP coders are - I did not want to use a auto increment (although I am very aware of it - I have used it before) - also "id" is way over used as a field name - It's just been a while since I created a hit counter - But Thanks Anyways

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.