Hi could anyone help me, i would like to check if a mysql table already exists, and if so do something, if not do something else...

heres my try:

<? 

@$db = mysql_connect('localhost', 'user', 'pass');

 if (!$db)
 	{echo 'Error: Could not connect to the database. Please try again later.';
	exit;
	}

mysql_select_db('mydb');

$tbl = "SHOW TABLES LIKE 'tablename'";

if (!$tbl)
	{echo 'table does not exist';
	exit;
	}

echo "connected!"

?>

    mnn, as a newb, could you give me a bit more info?

    thanks

      Write a Reply...