Delete all data from a table, without deleting the structure.

We return briefly to SQL'ing, to look at an example on how to delete all content in a table. ..
So now we have filled up our table 'contacts' with a lot of tests. We are ready to use the database for real things, and we want to delete every row in the table.
How is that done?
Here is a solution that deletes everything without messing up the structure.

$con=mysqli_connect('', 'root', 'Your_Password', 'dbname'); 
if (mysqli_connect_errno()) { 
  echo "Error connecting to DB"; 
mysqli_query($con, 'TRUNCATE TABLE contacts'); 

As you see in the above example deleting all content is quite simple. Again SQL is our friend and provide the TRUNCATE with which we can clean out the table.