You have two syntaxes to think about, PHP and SQL.
The SQL query you want will have single quotes in it.
Code:
SELECT dish, price FROM meals WHERE meal LIKE '%something%'
The PHP code is building a string by concatenating literal strings, enclosed in double quotes, with variables.
PHP Code:
$string = "Some literal concatenated with a " . $variable . " plus another literal string";
Your literal string contains single quotes, so you will have single quotes within the double quoted literal.
PHP Code:
$string = "A literal with 'single quotes' inside of it.";
The single quotes just happen to need to be before and after the variable you're concatenating with the strings, so you get the double quotes following the single quotes.
PHP Code:
$string = "A string with a '" . $variable . "' enclosed in single quotes.";
Bookmarks