Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

Simple error, but I am lost please help.

Aloittaja m33rra, joulukuu 22, 2013, 05:28:46 IP

« edellinen - seuraava »

m33rra

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

Kindred

You are missing a closing parens in your second if statement
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

margarett

And you should use $smcFunc instead of direct mysql function calls ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: