Page 1 of 1

Inserting data from a form to a specific column in MySQL

Posted: Sat Aug 13, 2011 6:13 am
by implications
I have created a table in MySQL that consists of four columns.

Column 1 - Column 2 - Column 3 - Column 4

Of the four columns, column 1, 2 and 4 have already been filled and I want one of the forms to specifically insert data into Column 3 without affecting/replacing the data that is already present in the other columns. How would I go about inserting it into one of the rows but only inserting it into Column 3?

Re: Inserting data from a form to a specific column in MySQL

Posted: Sat Aug 13, 2011 6:22 am
by oscardog

Code: Select all

mysql_query("UPDATE your_table SET column3 = 'Your-Value-Here' WHERE your_primary_key_column = 'Row-Id");
If you simply want to update every single row, remove everything from 'WHERE' onwards.