Home > Article > Backend Development > mysql-PHP-MySQL always increments by 4 and cannot increment by 1
mysqlphp
The code is as follows: when the ct value is 4, the output is 4 5 5, but at this time the actual value of ct in the database is 8, and the self-increasing method using the commented out sentence is the same. 4. Please ask God to solve it
Add that there is no problem in executing comments in phpmyadmin
<code>$count = mysql_query("SELECT ct FROM count WHERE class='counter';");//mysql_query("UPDATE count SET ct=ct+1 WHERE class='counter';");if($row = mysql_fetch_row($count)){ echo $row[0]." "; $row[0]++; echo $row[0]." "; mysql_query("UPDATE count SET ct=$row[0] WHERE class='counter';"); echo $row[0]." "; echo mysql_error();}mysql_close();</code>