Jump to content

[SOLVED] TRUNCATE TABLE IF EXISTS `Users` - not valid?


PC Nerd

Recommended Posts

Hi,

 

mysql spits out he following error in phpmyadmin:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF EXISTS `Users`' at line 1

 

so...... im assuming from that that the TRUNCATE statement doesnt allow you to place teh "IF EXISTS" with it..... so what can i do as an alternative?

 

Thanks

honestly, all you really need here is:

 

<?php

/*
MySQL Connection Here
*/

$q = @mysql_query( "TRUNCATE TABLE `Users`" );
$result = ( $q ) ? "Table 'Users' does exist, and has been truncated." : "Table 'Users' does not exist";
echo $result;

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.