PDA

View Full Version : getting mysql error codes


AN-net
10-08-2005, 08:32 PM
ok im trying to get the mysql error codes from $DB_site but im not sure. what im really trying to do is check if a column exists or not. so if someone has a better way of checking please post or if they know how to get error numbers;)

noppid
10-08-2005, 08:47 PM
This is part of the update to commbull I just posted.


$doupdate = 0;
$doupdate_type = 0;
$cols = $db->query_read("SHOW COLUMNS FROM ". TABLE_PREFIX ."user ");

while ($columns = mysql_fetch_assoc($cols))
{
if( $columns[Field] == "receivebulletin" )
$doupdate = 1;
if( $columns[Field] == "receivebulletin_type" )
$doupdate_type = 1;
}
$db->free_result($cols);

if( $doupdate == 0 || $doupdate_type == 0 )
doinstall($session[sessionhash]);