hello , i hope i get some help for this : apache_error_logs here is the PHP code : i don't know why the scripte can't update the data in my database and get it again to show it as result . feel free to ask if you didn't understand anything waiting anyone to help thanks
Try replacing with this: //query the database if(!$query = mysql_query("SELECT * FROM results")) { die(mysql_error()); } //loop through and return results while($row = mysql_fetch_assoc($query)) { //make array $json[$x] = array("choice" => $row["choices"], "votes" => $row["votes"]); } PHP:
[Mon Mar 14 15:25:46 2011] [error] [client .18.35] PHP Notice: Undefined variable: x in /home/**********/public_html/poll/poll.php on line 28, referer: http://*******.com/ i got this error on apache logs and still nothing happend on the result
That wouldn't break the script, but it would prevent setting the json array. Have you confirmed that there is data in the table using phpmyadmin or another direct method? Also, as for the json[] array, what are you trying to use for the key?
I see. Using the code I did above, try: //query the database if(!$query = mysql_query("SELECT * FROM results")) { die(mysql_error()); } //loop through and return results $x = 0; while($row = mysql_fetch_assoc($query)) { //make array $json[$x] = array("choice" => $row["choices"], "votes" => $row["votes"]); $x++; } PHP:
i did and there's no error on apache error logs , also i see that the result affichage had some littel change . but after i voted and click send the result didn't add my vote (+1) and i go to see if there's anychange on database table and i see they are still 0 . there's one thing left and i think it's the only one i missed .... this msg : Data in this table cannot be edited because it has no primary key. i'm using webmin not phpmyadmin thats why i found some prob to managed my DBs .