I have a DB table that I may want to add fields to in the future. How can I structure my insterts and updates so that adding fields wont break the queries?
| SitePoint Sponsor |
I have a DB table that I may want to add fields to in the future. How can I structure my insterts and updates so that adding fields wont break the queries?
http://www.echo-consulting.net - Sound Solutions for Online Inspriations.
If the new fields are NOT NULL, or don't have a default value, your queries will break no matter what you do.
That said, if your new fields can take NULL or default values, just remember to list the field list in your insert statements:
And not like this:Code:INSERT INTO table1 (field1, field2) VALUES ('value1', 'value2');
Code:INSERT INTO table1 VALUES ('value1', 'value2');
Bookmarks