Reputation: 480
Should this delete all records in my SQL table?
<?php
$con = mysql_connect("localhost","bikemap","pedalhard");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("test", $con);
mysql_query("DELETE * FROM gpsdata");
mysql_close($con);
?>
Upvotes: 5
Views: 4451
Reputation: 4321
DELETE
differs from Truncate
. But if your use case is simple, go to any one.
Truncate
DELETE
Upvotes: 1
Reputation: 1887
You might want to check out MySQL's Truncate command. That should remove all records easily.
Upvotes: 2
Reputation: 839054
The DELETE
syntax doesn't allow a star between DELETE
and FROM
. Try this instead:
mysql_query("DELETE FROM gpsdata");
Upvotes: 5