MYSQL/PHP Question

Soldato
Joined
16 Apr 2007
Posts
23,436
Location
UK
Hey all,

Got a question from a friend - I've not coded PHP for so long I can't answer it for him :eek: :( I've lost my touch :p

Basically, he needs a button - that upon clickage - will erase the contents of a certain table (I.e. Not completely delete the table - just delete its contents).

Any help with this would be appreciated :)

Marky
 
He just needs to truncate the table after a form submission

Code:
if(isset($_POST["delete_button"]))
{
$query = "TRUNCATE TABLE 'name_of_table'";
$result = mysql_query($query) or die(mysql_error());
}

Should do it... I think...
 
Back
Top Bottom