Jump to content

MySQL TRUNCATE TABLE in PHP just will not work


jdowey

Recommended Posts

for some reason I can not truncate my table, I am at a lost, can any one help me and tell me

what I am doing wrong?  this is my code.

 

<?php

$host="mysql";

$username="******";

$password="*******";

$database="webhistory";

$table="webhistory";

 

$connection = mysql_connect("$host", "$username", "$password") or die ("Unable to connect to server");

mysql_select_db("$database") or die ("Unable to select database");

$sql = "TRUNCATE TABLE `$table`";

mysql_query($sql);

echo "Table Deleted";

mysql_close($connection);

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.