I am very new to PHP and MySql. Is there any method by which using PHP script taking value through input box can we set the default value of the column using an update query with this value, rather than alter table function?
Update 1:
I want whatever value I send through my form to become default value of that column. There will be some other columns, whose values should change and not set as default, while other default values should appear in the input box for further updating.
For example, there are 3 columns: A, B, C. Column A has currdate value. Columns B and C are some integer values. Say a user opens the form, he sees the currdate is 02-07-2012 for the column A. Then he enters some values: B = 5, C = 6. The next day when the user opens the form, the currdate will become 03-07-2012. Simultaneously the value of B and C will automatically change from null to 5 and 6, with previous row value the same as default value.
So is it possible that every new row takes the previous value entered from the form as the default value of the column set in the mysql table?
As I understood You have input fields which update MySQL table. And You have some information in database which will be updated. And fields which are not filled, are not updated in mysql, so it does not empty rows? If that, You could get data from database, then after submitting a form, check whether field is empty and if field is empty, add to that field value which was got from database.
I dont remember how I could go through each input, so I added class, which is not good. Search in google – each loop for input field jquery.