I am not exactly sure why this is not working. It checks to make sure certain fields are present and if they are not present it try's to create them. It is an update to one of my scripts, but I can not figure out why it is not working correctly. Any help would be great. Thanks! <?php $inscript = true; include('config.php'); $result = mysql_query("SELECT `adsense_pubid`,`adsense_channel` FROM `".$SQL_Ext."_settings`"); if(0 == $result) { $result = mysql_query('ALTER TABLE `'.$SQL_Ext.'_settings` ADD `adsense_pubid` VARCHAR( 100 ) NOT NULL AFTER `add_to_site` , ADD `adsense_channel` VARCHAR( 100 ) NOT NULL AFTER `adsense_pubid`'); if(0 != $result) { echo 'Updated your SQL with the adense varibles<br />'; echo 'If you have not already add the following to your<br />'; echo './includes/config.php at the bottom before the '.chr(63).'><br /> '; echo '$adsense_pubid = $row[\'adsense_pubid\'];<br /> $adsense_channel = $row[\'adsense_channel\'];'; } else { echo 'Contact exodus something is wrong. The update can not create the needed sql fields.'; } } else { echo 'Your site has already been updated<br />'; echo 'If you have not already add the following to your<br />'; echo './includes/config.php at the bottom before the '.chr(63).'> '; echo '$adsense_pubid = $row[\'adsense_pubid\'];<br /> $adsense_channel = $row[\'adsense_channel\'];'; } ?> PHP:
thats a mean and slow way to get the table names try something like DESCRIBE the_table_name; for your mysql query, this will return the column names as well as there types.