Quote:
Originally Posted by Kirk Y
Don't forget to take table prefixes into account in your SHOW COLUMNS query.
|
Oh shit... thanks for the heads up!
$vidcolumns = $db->query_read("SHOW COLUMNS FROM " . TABLE_PREFIX . "video");
$videocolumns = array();
while ($vidcolumn = $db->fetch_array($vidcolumns))
{
$videocolumns[] = $vidcolumn['Field'];
}
if (!in_array('timelength', $videocolumns))
{
echo('<li>Altering Table <strong>' . TABLE_PREFIX . 'video</strong> ... ');
$db->query_write("ALTER TABLE video ADD timelength int(10) unsigned NOT NULL");
}