I'm trying to run this query:
$result = db_query("INSERT INTO `timesheets` (clientid, candid, weekending, department, orderno, basicpay, basiccharge, otpay, otcharge, ot2pay, ot2charge, status, hue, huc) VALUES (`$client`, `$cand`, `$week_ending`, `$department`, `$order_no`, `$basic_pay`, `$basic_charge`, `$ot_pay`, `$ot_charge`, `$ot2_pay`, `$ot2_charge`, `$status`, `$hue`, `$huc`)");
if($result){
print 'Success! ID of last inserted record is';
}
else {
die('Error : ' . db_error());
}
These are the values from the form
$client = db_quote($_POST['client']);
$cand = db_quote($_POST['cand']);
$order_no = db_quote($_POST['order_no']);
$department = db_quote($_POST['department']);
$week_ending = db_quote($_POST['week_ending']);
$basic_pay = db_quote($_POST['basic_pay']);
$hue = db_quote($_POST['hue']);
$basic_charge = db_quote($_POST['basic_charge']);
$huc = db_quote($_POST['huc']);
$ot_pay = db_quote($_POST['ot1_pay']);
$ot_charge = db_quote($_POST['ot1_charge']);
$ot2_pay = db_quote($_POST['ot2_pay']);
$ot2_charge = db_quote($_POST['ot2_charge']);
$status = 'cand';
The value of $client
in this instance is "725". The error I am getting is Error : Unknown column ''725'' in 'field list'.
How can this be - the column name in the timesheets table is clientid
. I'm trying to put the value 725 into the clientid
column. Is there a syntax error somewhere? The error message doesn't seem to make sense?