I want to make sure about the syntax using mysql and PHP.

Here is the line of code:

$query="SELECT * FROM books WHERE ". $searchtype. " LIKE '%" .$searchterm.
"%' ";
.............................................

Am I correct that the reason for the single quote within the expression
above is that:

"SELECT * FROM books WHERE"  // Beginning and end double quotes before the
variable $searchtype

.  // concatation operator

$searchtype // variable

. // concatation operator

"LIKE '%"  // Beginning of double quote and then beginning single quote
beacuse it is the beginning of a string which then ends before the variable
$searchterm.

. // concatation operator

$searchterm // variable

. // concatation operator

"%' "; // beginning of double quote for regex synmbol which then ends the
string and then an end double quote.

Thank you.
Tony Ritter













-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to