In a simple voting system example made by php, the number of votes does not change after the web page is voted, but the number of votes in the database is changed. the code for changing the number of votes on the web page is as follows: PHPcode & lt ;? If ($ voted & amp; $ already_voted) {$ SetCookie (& quot; already_vot a php example of a simple voting system
No votes remain unchanged after the web page vote, but the number of votes changed in the database will change accordingly.
The code is as follows:
PHP code
Online voting system Online voting system
Theme: our elected squad leaders
The database only has one table vote_banzhang (votee varchar (12), vote_numbers int (4) master code)
------ Solution --------------------
Debugging is enough.
Output the POST value;
Check whether the mysql connection is successful;
Check whether the query execution is valid;
------ Solution --------------------
You didn't say that you had any trouble.
Add an error_reporting (E_ALL | E_NOTICE); to the top of the code );. Open the error prompt and check what errors are reported.
In addition, let's take a rough look at $ SetCookie ("already_voted", "1"); what is this?
------ Solution --------------------
The data is not stored in the database. it should have not received the value. you should make an IF judgment to determine whether the value has been received before the village database