[DB] Problem with DELETE TABLE
| From: | Helgi Þormar | Date: | Tue, 09 Mar 2004 07:05:07 +0000 |
| Subject: | [DB] Problem with DELETE TABLE | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-11174@lists.php.net to get a copy of this message | ||
Hi ...
If you're using DB 1.6 then it would be qouteSmart()
And like chuck pointed out you shouldn't quote the whole query
But to empty a table you use:
TRUNCATE TABLE 'table_name'
Cheers ;)
--
Regards
Helgi
"Hi
I have this code to process with an easy sql-statement:
$sql = 'DELETE TABLE users';
$sql = $this->_dbc->quote($sql);
$result =& $this->_dbc->query($sql);
if (DB::isError($result)) {
echo 'ErrMsg: ' . $result->getMessage() . "<br>";
echo 'UsrMsg: ' . $result->getUserInfo() . "<br>";
exit;
}
Gives the following error (on non-empty users-table):
ErrMsg: DB Error: syntax error
UsrMsg: 'DELETE TABLE users' [nativecode=1064 ** You have an error in
your SQL syntax. Check the manual that corresponds to your MySQL server
version for the right syntax to use near ''DELETE TABLE users'' at line
1]
What could be wrong?"