note 21941 deleted from function.mysql-list-tables by didou

From: Date: Sat, 17 May 2003 21:22:23 +0000
Subject: note 21941 deleted from function.mysql-list-tables by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-48274@lists.php.net to get a copy of this message
Note Submitter: chrisshaffer@bellsouth.net Here's a little function that will tell you if a table exists. (this function assumes an active db connection as well as a selected database) function mysql_table_exist($tableName) { $query = "SELECT COUNT(*) FROM $tableName"; $result = mysql_query($query); $num_rows = @mysql_num_rows($result); if($num_rows) { return TRUE; } else { return FALSE; } } Can't believe there isn't a function like this as part of the core MySQL support. (To be honest, there probebly is a function like this, I just over looked it. It would be like me to do things the hard way ;) )

« previous php.notes (#48274) next »