Is there a way to update and insert at the same time?
What I'm trying to do is allow users to edit some information, and a part of the editing might be to add additional information.
I'm using an if(isset) to check the _POST if there is any information there. The problem is that if I add something to the info, it takes the last set of data and overwrites the original piece of data.
If anyone has any ideas, I'd greatly appreciate it.
Thanks,
w.
Update and Insert simultaneously
Moderator: General Moderators
Re: Update and Insert simultaneously
You can either put all the fields on one table and issue 1 update statement, or create multiple tables and issue the queries separately. There's trade offs to both approaches that will be obvious if you start experimenting around
Re: Update and Insert simultaneously
Yeah, they're in separate tables; too much information to hold in a single table.
What I got to work was to do a select on the table to see if one of the fields came back as an array, and ran from there.
Thanks.
What I got to work was to do a select on the table to see if one of the fields came back as an array, and ran from there.
Thanks.
Re: Update and Insert simultaneously
have you looked into the INSERT... ON DUPLICATE KEY UPDATE?
http://dev.mysql.com/doc/refman/5.0/en/ ... icate.html
http://dev.mysql.com/doc/refman/5.0/en/ ... icate.html