Jump to content

Recommended Posts

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

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.