Home > Database > Mysql Tutorial > mysql-PHP-MySQL always increments by 4 and cannot increment by 1

mysql-PHP-MySQL always increments by 4 and cannot increment by 1

WBOY
Release: 2016-10-09 08:32:05
Original
981 people have browsed it

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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template