phpQuestioner Posted September 9, 2007 Share Posted September 9, 2007 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"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/68542-solved-troubles-with-my-hit-counter/ Share on other sites More sharing options...
d22552000 Posted September 9, 2007 Share Posted September 9, 2007 so whats the problem? Quote Link to comment https://forums.phpfreaks.com/topic/68542-solved-troubles-with-my-hit-counter/#findComment-344547 Share on other sites More sharing options...
phpQuestioner Posted September 9, 2007 Author Share Posted September 9, 2007 its not updating........ Quote Link to comment https://forums.phpfreaks.com/topic/68542-solved-troubles-with-my-hit-counter/#findComment-344552 Share on other sites More sharing options...
TheFilmGod Posted September 9, 2007 Share Posted September 9, 2007 Lol. No offense but you made a pretty funny mistake. ;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. Quote Link to comment https://forums.phpfreaks.com/topic/68542-solved-troubles-with-my-hit-counter/#findComment-344557 Share on other sites More sharing options...
phpQuestioner Posted September 9, 2007 Author Share Posted September 9, 2007 yeah - ok - i did that - but it still is not updating <?php mysql_query("UPDATE mytable SET myrow=myrow+1 WHERE number='1'"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/68542-solved-troubles-with-my-hit-counter/#findComment-344569 Share on other sites More sharing options...
phpQuestioner Posted September 9, 2007 Author Share Posted September 9, 2007 ok - i know what the problem was. in my real script i mis-spelled localhost - i had localhots - now i feel stupid - thanks everyone for their help. Quote Link to comment https://forums.phpfreaks.com/topic/68542-solved-troubles-with-my-hit-counter/#findComment-344572 Share on other sites More sharing options...
d22552000 Posted September 9, 2007 Share Posted September 9, 2007 ciao idioto Quote Link to comment https://forums.phpfreaks.com/topic/68542-solved-troubles-with-my-hit-counter/#findComment-344577 Share on other sites More sharing options...
TheFilmGod Posted September 9, 2007 Share Posted September 9, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/68542-solved-troubles-with-my-hit-counter/#findComment-344583 Share on other sites More sharing options...
phpQuestioner Posted September 9, 2007 Author Share Posted September 9, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/68542-solved-troubles-with-my-hit-counter/#findComment-344592 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.