Hello all,
I am having issue with UPDATE if I take away the user_id part it updates as should but as soon as I put it back it gives a issue:
Was unable to update the record containing 010461598!
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 'record_status.user_id ='B-123456789' WHERE fin = '010461598'' at line 1
the code is below (its a function to update the table called record_status and delete the record from query as its not needed if its blocked):
<?php
$_GET['id'] = "010461598";
$fin = $_GET['id'];
$user_id = "B-123456789";
function block_record($fin, $user_id)
{
$sql_u = "UPDATE record_status SET record_status.status ='B' record_status.user_id ='$user_id' WHERE fin = '$fin'";
$results_u = mysql_query($sql_u) OR die("Was unable to update the record containing ".$fin."!<br />" . mysql_error());
$affected_u = mysql_affected_rows();
if($affected_u == 1)
{
$sql_d = "DELETE FROM query WHERE ein = '$fin'";
$results_d = mysql_query($sql_d) OR die("Was unable delete ".$fin." from the db table irs_rawdata! <br />" . mysql_error());
$affected_d = mysql_affected_rows();
if($affected_d == 1)
{ return 'S_delete'; } else { return 'E_delete'; }
}
else
{
{ return 'E_delete'; }
}
};
include '/home/dev/www/lib/db_config_cr-dev.php';
include '/home/dev/www/lib/db_conn-select.php';
$result = block_record($fin, $user_id);
echo $result;
?>
EDIT: I found the mistake I did not have a ',' in between the two update fields.
Thanks for the assistance!
Sincerely,
Christopher