I have the following string that I am tryingt execute, however I get an error that prevents the code from running correctly.
PHP Code:
$str_row=$str_row.'<td><a href="display_md4c8.php?project='.$row['project'].'&status=Plan.order">'.$row1['planned'].'</a></td>';
Quote:
|
SELECT * FROM tbl_md4c WHERE project=3418499 AND status=Plan.order ORDER BY project ASC DB Error, could not query the databaseMySQL Error: Unknown column 'Plan.order' in 'where clause'
|
If I run the query directly in the db, this is the error that I get
Quote:
|
#1054 - Unknown column 'Plan.order' in 'where clause'
|
If I put quotes around the Plan.order, then it works
Quote:
SELECT *
FROM tbl_md4c WHERE project =3418499 AND STATUS = "Plan.order" ORDER BY project ASC
|
If I have phpMyAdmin create the php code for the query, it generates
Quote:
|
$sql = "SELECT * FROM tbl_md4c WHERE project=3418499 AND status=\"Plan.order\" ORDER BY project ASC";
|
where it is inserting \" around the Plan.order
However if I try to add the \" into my original string like so
Quote:
|
$str_row=$str_row.'<td><a href="display_md4c8.php?project='.$row['project'].'&status=\"Plan.order\"">'.$row1['planned'].'</a></td>';
|
this is the resulting error message.
Quote:
|
SELECT * FROM tbl_md4c WHERE project=3418499 AND status=\\ ORDER BY project ASC DB Error, could not query the databaseMySQL Error: 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 '\\ ORDER BY project ASC' at line 1
|
|