|
Posted by Sanders Kaufman on 11/14/07 05:14
"Toby A Inkster" <usenet200707@tobyinkster.co.uk> wrote in message
news:rf2p05-nrb.ln1@ophelia.g5n.co.uk...
> John S. wrote:
>
>> $sql = "DROP TABLE IF EXISTS 'products'";
>> $result = mysql_query($sql,$conn);
>
> Single and double quote marks have very specific meanings in SQL. You want
> to wrap the table name in double quotes, not single.
I was under the impression that square braces were the way to go:
$sSQL = "DROP TABLE IF EXISTS [products]";
>
> DROP TABLE "products"
>
> However, MySQL has a nasty "feature" whereby is misinterprets the meaning
> of double quotes. For this reason, it's probably nest to just leave them
> out:
>
> DROP TABLE products
>
> As the quote marks are only really needed if the table name contains
> certain non-alphanumeric characters.
>
> --
> Toby A Inkster BSc (Hons) ARCS
> [Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
> [OS: Linux 2.6.12-12mdksmp, up 7 days, 6 min.]
>
> TrivialEncoder/0.2
> http://tobyinkster.co.uk/blog/2007/08/19/trivial-encoder/
Navigation:
[Reply to this message]
|