|
Posted by Toby A Inkster on 11/13/07 17:11
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.
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]
|