Jump to content

Archived

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

nachotico

MySQL TRUNCATE TABLE in PHP

Recommended Posts

Just to help some fulks who don't know that and helping to grow the community

 

<?php
$host="localhost"; 
$username="user";
$password="mysql_password";
$database="database_name";
$table="table_name";

$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);
?>

have a nice day...

Share this post


Link to post
Share on other sites

That's such a very scary script.

Share this post


Link to post
Share on other sites

×
×
  • 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.