On Sat, 16 Mar 2002, Philip J. Newman wrote:
> A few of us folk at PhilipNZ.com would like to know about using " and ' or ` in My
>Sql when calling information from the database.
> we have always used
> $sql = "SELECT * FROM `hyperlinks` ORDER BY `clicks` DESC LIMIT 0, 10";
> but where told that the ` was not required
> $sql = "SELECT * FROM hyperlinks ORDER BY clicks DESC LIMIT 0, 10";
The backtick (`) has an entirely different meaning and shouldn't be used
to delimit arguments in MYSQL statements.
It's used to indicate that you want to execute a command external to PHP
(for instance, `/bin/ls`).
The standard quote (') should be used to delimit string literals in MYSQL
statements. Use it to surround strings you're inserting into or comparing
against VARCHARs, CHARs, TEXTs, etc.
Both are unnecessary in the statements you cite above. Here's a simple
statement using the standard single quote:
$sql = "UPDATE mytable SET name='Best Table Of All' WHERE id=3";
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php