DB: table exists

From: Date: Sat, 02 Oct 2004 12:49:59 +0000
Subject: DB: table exists
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14731@lists.php.net to get a copy of this message
Hi! I want to detect if a given table exists in a Database. Might it be possible that on MySQL 3.x the Error-Object is not properly thrown when a table does not exist? The following code detects properly on MySQL 4, but not on Version 3.x. Seems to be the same problem when using tableInfo() when trying to check if a table exists in the database. - - - - - - - - - - - - - -- - -- - -- - - - if (DB::isError($hasDataTableRes)) { $hasDataTableCode = $hasDataTableRes->getCode(); if($exists=='DB_ERROR_NOSUCHTABLE') $hasDataTable = false; } else { $hasDataTable = true; } echo $hadDataTable; - - - - - - - - - - - - - -- - -- - -- - - - cheers, M

« previous php.pear.general (#14731) next »