Dammit, that code looks right.

So ....

1. Have you  tried it at the mysql console? What results?
2. How accurately does day match $day? Have you tried "=" instead of LIKE? 
Maybe it's doing it twice?
3. Is day distinct? How do you know you have only one?

When you tested with 2, assuming i had a value of 1, was the result 5 or 6?

Strange - Miles Thompson

At 05:43 PM 5/16/01 -0400, SubvertTRL wrote:
>I am making a simple script that counts votes per day for a site and uses a
>simple database, All i want to do is increment the field by one.  the first
>time i run the script it works, after that it doubles it.  so instead of 1,
>it adds 2. i know its doubling it because i tried adding 2, 3, and 4 and it
>doubled all those...  the field is a BIGINT UNSIGNED, i've tried it with
>just INT, nothing seems to work,  i used to have PHP get the field value,
>increment it, then update the row in the database with the new number, it
>doubleed it that way. now i use straight mySQL code to do it all in one
>shot, still doubles it.. can any one help me???
>heres my code... less database info :)
>$results = mysql_query("UPDATE trlvotes SET i=i+1,  WHERE day LIKE '$day'");
>if (mysql_affected_rows($results) == 0){
>  mysql_query("INSERT INTO trlvotes (id, day, i) VALUES (null, '$day', 1)");
>you can email me at [EMAIL PROTECTED]
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to