Ok, I've had enough of looking at the same piece of code now. Someone please enlighten me as to what simple bloody thing it is I'm missing:
$pp2 = $_REQUEST["pp"];
$io2 = $_REQUEST["io"];
$sn2 = $_REQUEST["sn"];
$re2 = $_REQUEST["re"];
$sd2 = $_REQUEST["sd"];
$ed2 = $_REQUEST["ed"];
$dp2 = $_REQUEST["dp"];
$rn2 = $_REQUEST["rn"];
$pp = "Product Price";
$io = "Model No";
$sn = "Serial No";
$re = "Ref";
$sd = "Start Date";
$ed = "End Date";
$dp = "Date Paid";
$rn = "Reciept No";
$query = "UPDATE $table SET '$io='$io2', $pp='$pp2', $sn='$sn2', $re='$re2', $sd='$sd2', $ed='$ed2', $dp='$dp2', $rn='$rn2' WHERE ID='$id'";
echo $query."<br><br>";
mysql_select_db($db, $link) or die ($db . " Database not found. " . $user);
mysql_db_query ($db, $query) or die (mysql_error());
The echo $query line is just in there to reassure me I'm not going insane. It's producing:
UPDATE loandata SET Model No='AP22', Product Price='39.0000', Serial No='220801', Ref='TLS00700', Start Date='2008-01-25', End Date='2008-02-25', Date Paid='2008-02-13', Reciept No='987954' WHERE ID='561'
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Model No='AP22', Product Price='39.0000', Serial No='220801', Ref='TLS00700', S' at line 1
It's practically an indentical UPDATE statement as one I use inside a different IF clause (just to identify which variables have been sent by the form) which works as expected.
Someone please save my impending suicide and show me up as the amatuer I've turned out to be with an answer.
Cheers,
Dalefish