Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Embedded mySQL - Does a table exist?

Status
Not open for further replies.

poplarman

IS-IT--Management
Dec 15, 2001
12
US
I want to carry out table retrieval only if a table exists. Currently I'm carrying out the call unconditionally and it's not going on to the next bit of code.

This is what I want to do but ONLY if the table exists :-

use DBI;
use CGI qw:)standard);
local ($dbh, $sth);
$dbh = DBI->connect ("DBI:mysql:host=server;database=database",
"database", "password", {PrintError => 0, RaiseError => 1});
$sth = $dbh->prepare ("SELECT * FROM TableData");
$sth->execute ();
while (my @RetrievedData = $sth->fetchrow_array ()) {
do something
}

Any Help please ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top