mySQL Addition Problem

From: Date: Wed, 16 May 2001 21:43:22 +0000
Subject: mySQL Addition Problem
Groups: php.db 
Request: Send a blank email to php-db+get-9379@lists.php.net to get a copy of this message
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)"); } mysql_close(); you can email me at subverttrl@yahoo.com thanks!

« previous php.db (#9379) next »