String within a string

From: Date: Sun, 16 Jun 2002 17:10:18 +0000
Subject: String within a string
Groups: php.general 
Request: Send a blank email to php-general+get-102402@lists.php.net to get a copy of this message
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

« previous php.general (#102402) next »