After creating a connection using "mysqli", you try to delete all entries in "dbName" using mysql_query.
Change the code to something like
<?php // Create connection $con=mysqli_connect("localhost","username","password","dbName"); // Check connection if (mysqli_connect_errno($con)) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql = "TRUNCATE TABLE tableName"; mysqli_query($con, $sql) or die(mysqli_error()); ?>
See if this works and let me know.
source share