SetToLoki Posted October 21, 2007 Share Posted October 21, 2007 I have some data in a php array and I want to insert the data from this array into several tables. now my problem is that some of the data will allready be entered into the databse and if it is I want to update it. if it isn't there I need to add it. is there an sql query that would help me do this efficently Link to comment https://forums.phpfreaks.com/topic/74211-solved-update-or-insert/ Share on other sites More sharing options...
trq Posted October 21, 2007 Share Posted October 21, 2007 is there an sql query that would help me do this efficently Yeah, take a look at the REPLACE INTO syntax. Link to comment https://forums.phpfreaks.com/topic/74211-solved-update-or-insert/#findComment-374869 Share on other sites More sharing options...
Simon Moon Posted October 21, 2007 Share Posted October 21, 2007 Also a possible more accurate thing of what you describe you want is this bit. http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html Maybe there is a better way to do what you want al together if you give more details on what you are working on. Link to comment https://forums.phpfreaks.com/topic/74211-solved-update-or-insert/#findComment-374951 Share on other sites More sharing options...
fenway Posted October 22, 2007 Share Posted October 22, 2007 Also a possible more accurate thing of what you describe you want is this bit. http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html Maybe there is a better way to do what you want al together if you give more details on what you are working on. If appropriate, this is better, since REPLACE does an implicit DELETE. Link to comment https://forums.phpfreaks.com/topic/74211-solved-update-or-insert/#findComment-375449 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.