how to do this?
like ive seen some HARSH codes with things i dont understand in themm like information.schema and datetime
whats the simple way to add a column to a table if it doesnt exist?
and what the heck how to not add it if it already exists
? help? mysql.
also this seems to be overdoing it: i mean the table will have lots of columns and what if one of them is names emailhack and email isnt there will its still says email is in "array"?
$fields = mysql_list_fields('database_name', 'table_name');
$columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++) {$field_array[] = mysql_field_name($fields, $i);}
if (!in_array('email', $field_array))
{
$result = mysql_query('ALTER TABLE table_name ADD email VARCHAR(10)');
}