Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.