Originariamente inviato da Mega69
Grazie. Se a qualcuno può essere utile, si può fare così:
Codice PHP:
function TableExists($tablename, $db) {
// Get a list of tables contained within the database.
$result = mysql_list_tables($db);
$rcount = mysql_num_rows($result);
// Check each in list for a match.
for ($i=0;$i<$rcount;$i++) {
if (mysql_tablename($result, $i)==$tablename) return true;
}
return false;
}
ma ai fini della sicurezza non è meglio usare un md5 della tabella? dato che ci sei...
Codice PHP:
function TableExists($tablename, $db) {
// Get a list of tables contained within the database.
$result = mysql_list_tables($db);
$rcount = mysql_num_rows($result);
// Check each in list for a match.
for ($i=0;$i<$rcount;$i++) {
if (md5(mysql_tablename($result, $i))==$tablename) return true;
}
return false;
}