Page 1 of 1

mySQL keyword in query, how to handle?

Posted: Sun Oct 29, 2006 10:38 am
by dwessell
Hey all.. I have a query that goes something like this:

Code: Select all

"UPDATE ItemInformation SET ItemUsed = 1, LastItem = 1 WHERE GameNumber = `$row[0]` AND 
				TeamNumber = $innerRow[2] and Item = $itemResult[0]";
$itemResult[0] might possibilty contain a SQL keyword, like from.. How can I handle this?

Thanks
David

Posted: Sun Oct 29, 2006 1:04 pm
by ianhull
You mean the value of $itemResult[0] could = "FROM"

That should be ok.

Code: Select all

$itemResult[0]  = "FROM";

"UPDATE ItemInformation SET ItemUsed = 1, LastItem = 1 WHERE GameNumber = `$row[0]` AND 
            TeamNumber = $innerRow[2] and Item = $itemResult[0]";

Posted: Mon Oct 30, 2006 4:52 pm
by feyd
So long as it's escaped as a standard string, MySQL won't care what's in it.