title: How do you truncate mysql table using php script
body: <p>I have been working with a php script that the user can upload a csv file to a mysql database. I can connect and get a uploaded successfuly message but when I browse the contents of the table there is nothing, so I decided to test the very first step in the script to see if I can first truncate existing data. however, this is not working either, so I suspect I'm doing something wrong from the get go. Below is the following scripts I'm using to do this. Why is this not working?</p>
  
  <p>CONNECT SCRIPT(connect.php)</p>
  
  <pre><code>&lt;?php
  $servername = "localhost";
  $username = "plfwinv";
  $password = "mypassword";
  
  // Create connection
  $conn = new mysqli($servername, $username, $password);
  
  // Check connection
  if ($conn-&gt;connect_error) {
  die("Connection failed: " . $conn-&gt;connect_error);
  } 
  echo "Connected successfully";
  ?&gt;
  </code></pre>
  
  <p>TRUNCATE SCRIPT(upload.php - The script I load)</p>
  
  <pre><code>&lt;?php
  
  include "connect.php"; //Connect to Database
  
  $deleterecords = "TRUNCATE TABLE plfwinvtable"; //empty the table of its current records
  mysqli_query( $conn, $deleterecords );
  
  ?&gt;
  </code></pre>