Can I avoid to overwrite a column with a NULL value on INSERT query?

dr.owl

New Member
I have two different queries in my php page for the same table, the first one is executed if I have two different values for two columns, but in some case, i can use only the first value, can I do it with the same query or should I use two different queries?\[code\]// query 1"INSERT INTO my_table (column_1, column_2) VALUES ('$value_1', '$value_2')";// second query, used if $value_2 is null"INSERT INTO my_table (column_1) VALUES ('$value_1')";// can I do something like this without use a SELECT for column_2 before the INSERT?$value_2 = null;"INSERT INTO my_table (column_1, column_2) VALUES ('$value_1', '$value_2')";// ======================================= new value =http://stackoverflow.com/questions/2022261/== ^ | ^ === mantain old value because it's null\[/code\]so can I execute an INSERT statement with new vals without overwrite the old vals with a null value?
 
Back
Top