Thursday 29 August 2013

Unknown column 'rates_test' in 'where clause'

Unknown column 'rates_test' in 'where clause'

I have the below mysqli command which gives the error message
Unknown column 'rates_test' in 'where clause'
$result1 = mysqli_query($con,"UPDATE Custom_Rates SET UserID=$id WHERE
TableName =" . $assigntable);
$id is a number returned by another query
$assigntable is a string passed to the function that the above query is in
but basically
$assigntable = array_search('Assign', $_POST);
And so will have the value rates_test
I can not work out what is wrong with the syntax of the query and what is
even odder if I change it to
$result1 = mysqli_query($con,"UPDATE Custom_Rates SET UserID=$id WHERE
TableName ='$assigntable'");
Which is one of the things I tried, I get
Unknown column 'Array' in 'field list'
$string = "UPDATE Custom_Rates SET UserID=$id WHERE TableName
=".$assigntable;
Outputs
UPDATE Custom_Rates SET UserID=Array WHERE TableName =rates_test
$string = "UPDATE Custom_Rates SET UserID=$id WHERE TableName ='" .
$assigntable . "'";
Outputs
UPDATE Custom_Rates SET UserID=Array WHERE TableName ='rates_test'

No comments:

Post a Comment