This is for a custom SMF chat box I am working with. I need a simple script to delete all of the info from a table. The code is returning an error though:
Parse error: syntax error, unexpected '{' in /home/playtotd/public_html/play/deletelivechatmessages.php on line 21
<?php
// Insert your database username here:
$user="REMOVED";
// Insert your db password here:
$password="REMOVED";
// Insert Database name:
$database = "REMOVED";
// The database table name:
$table = "ajax_chat_messages";
// you dont need to change this in most cases...
$server ="localhost";
// code...
$stmt = "TRUNCHATE $table";
$mysqli = new mysqli($server, $user, $password, $database);
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
die();
}
if($r = $mysqli->query($stmt) {
$r->close();
} else die("An error happened: ".$r->error);
?>
You are missing a closing parens in your second if statement
And you should use $smcFunc instead of direct mysql function calls ;)