On 17-May-2004 John Taylor-Johnston wrote:
> How can I check if a table exists in a mysql db.
function tableexists($tbl) {
$res = @mysql_query("SELECT COUNT(*) FROM $tbl");
return ($res ? true : false);
}
Regards,
--
Don Read [EMAIL PROTECTED]
-- It'
>But wouldn't it be easier to create the tables in the first place?
Travis,
It surely would. But for one situation, I don't/can't have access to phpMyAdmin to
install it.
At the same time, I wanted to learn how to do it.
--
John
I'm still learning. But isn't this much more fun than Perl!
> To
The manual says:
";
}
?>
To paraphrase, just use mysql_list_tables() to get a table list in a result
set, then go through the result set to see if the named table exists.
But wouldn't it be easier to create the tables in the first place?
cheers,
Travis
John Taylor-Johnston wrote:
How can I check
3 matches
Mail list logo