PHP - Problem
I'm attempting a tutorial on polls but keep getting an error (custom error written into the script, not a PHP error). I thought it might just have been me and some dodgy typing but I downloaded the source code and got the same result.
Source Code: http://www.melonfire.com/community/columns/trog/.collateral/00059/poll.zip
When i've voted on start.php it goes to vote.php, as it should, and displays "Error! Please try again" and nothing is entered into the db. Any ideas?
christodd posted this at 02:24 — 11th October 2003.
They have: 6 posts
Joined: Oct 2003
This is just a guess, but I'd assume that the file that it's writing the results to isn't writable by the webuser.
Make sure you are pointing to a world-writable directory in the config file, or if it uses a particular file, that you make it world-writable.
-Chris
Come read the BiteSize SQL Tutorial
Visit http://www.bitesizeinc.net/ for more technical help...
christodd posted this at 02:31 — 11th October 2003.
They have: 6 posts
Joined: Oct 2003
Disregard my last post... it uses mySQL. SO ... you have one of 2 problems.
First, that script says the same thing in two situations :
#1 - it doesn't get the $submit and $response variables. Some versions of PHP require that you use the $HTTP_POST_VARS['submit'] and $HTTP_POST_VARS['response'] variables at the top of the script. (or use $HTTP_GET_VARS if you're voting in the URL).
You can see if this is a problem by changing the text around a little bit in vote.php - the first time you see 'Error!', change it to 'I like cheese'. Then do it again. If you're page likes cheese, then it's a problem with the variable submission.
#2 - if you're page doesn't like cheese, then it's a problem lower down in the SQL query. You may not have the SQL settings correct, maybe you haven't created the tables, or maybe the username and password you are using isn't allowed to do "UPDATE" queries. Check your config.php file for the settings, and your SQL server for the table and database names.
Hope that helps.
-Chris
Bite Size Inc - Telework Consultants
Visit http://www.bitesizeinc.net/ for more technical help...
Suzanne posted this at 02:52 — 11th October 2003.
She has: 5,507 posts
Joined: Feb 2000
It may be $_POST['response'] as well, btw.
Cheese solves a lot of problems...
Khanny posted this at 05:00 — 11th October 2003.
They have: 51 posts
Joined: Dec 2002
cheers, I found the problem after trying another script that had previously worked. It seems my php.ini file had been deleted somehow. Reinstalled PHP and all works fine now.
Renegade posted this at 09:24 — 11th October 2003.
He has: 3,022 posts
Joined: Oct 2002
lol random missing php.ini files.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.