Take a look at the link I posted in that thread, and se if you can come up with a solution…
If it all fails, then post the code you arrive at, and lets take it from there.
You’re forgetting about the array variables…
For simple variables it works just fine that way, but for arrays you need to go out of the string and concatenate…
your $_POST variables should look like this:
$_POST[[COLOR="Red"]'[/COLOR]field[COLOR="Red"]'[/COLOR]] or $_POST[[COLOR="Red"]"[/COLOR]field[COLOR="Red"]"[/COLOR]]
99 times out of a 100 if a query is not working, then either you are not connected to the database or the structure or syntax in your query is wrong - or both.
after you establish you are connected to the database, if you echo to the screen the sql query that is actually being run you should be able to work out what is wrong with the query.
at the very top of your php script you should echo out the sent form data - $_POST or $_GET variables to make sure it has come across ok before doing anything else in your script.
there is no point writing or testing additional code if you haven’t first confirmed that all the data has come into the script correctly.
then this could be a good opportunity to hone your debugging skills.
what I would normally do in a situation like this is
start at the top of the script as specified in your form’s action attribute and add
echo 'got here'; die();
run your form to check if it gets to your php script
then move the above echo/die down, line by line if you have to, and add appropriate echo statements to display values of variables and then run the form again each time you move the echos.
as part of 3) insert the echos in each part of conditional blocks (IF blocks) to check your code logic is correct
keep doing this until your echos show something is not right. then back track your code to fix the error.
keep repeating 3) and 4) until you get to the end of your script and it works ok.
if you have a debugger, then debugguing will be easier as you can set break points and check values of variables which is essentially what the above steps are doing.
you shouldn’t need to test very simple queries outside of php first but for more complicated queries I normally develop and test in SQLyog where error message are usually more meaningful.
or if you are debugging someone else’s non working sql query coded in php, or whatever, it can be helpful to first echo out the actual query being run to check for syntax and/or structure errors.