PDA

View Full Version : Syntax problem with the WHERE command


The Reverend
04-28-2006, 03:23 AM
I have it run a query with $_GET['name'] as my variable

in this case it's always two words, ie "John Smith". I used the urlencode and urldecode functions in PHP to pass the whitespace from one page to the next, but when it's used to run the query it produces and error as a result of the whitespace.

What is the proper syntax for this line right here?

SELECT * FROM `table` WHERE name=john smith

The whitespace there causes a syntax error, is there a PHP function I can use to fix this problem?

guelphdad
04-28-2006, 04:31 AM
enclose your search string in quotations.