简体   繁体   中英

Can't update record

I'm trying to sync three scripts together to get cross domain profile editing working. The scripts are WordPress, BuddyPress, & JamRoom.

The code I'm using go to the test domain, get the profile's information from a php call that returns JSON, and then the JSON can be pushed to the WordPress/BuddyPress database.

The only problem is that I'm a front end developer wearing a backend's hat, so I'm learning as I go.

How can I check to see if the user_id already has entries under field_id (value 1 & 2) that have filled in values? And if that exists, simply update the entries. If it doesn't exist, simply create them.

Code I'm working with http://pastie.org/private/zivzakqyhzcbn3wkdfa6w

Columns I'm working with

id,field_id,user_id,"value","last_updated"

1,1,1,"admin","2011-03-07 00:35:52" 9,1,2,"YouRock","2011-03-07 01:11:32"

假设id是键,请使用ON DUPLICATE KEY UPDATE -statement

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM