Jump to content

updating query


sofia403

Recommended Posts

um, well im guessing it will have to be both ? i already have some entry in db, when users log in i just want them to either update existing records or just add a new value in some of the fields. Also i have separate "Update" button for each column.

 

So if "User1" logs in he already has a n entry in "city" so i want him be able to change that value, while "User2" might not have the city in the db yet.

 

Link to comment
https://forums.phpfreaks.com/topic/237748-updating-query/#findComment-1221770
Share on other sites

 

MySQL version 5.0.81-community-log

 

Hello, im still trying to find an answer how i can go about creating a query that would update or insert a value based on if an entry already exists or not in a table I'm using the query below, but its not working (not updating nor inserting anything) and i don't get any errors.

 

i copied this query from the web some place and not quite sure if this is best way to go about it.

 

So i have ApplicationStatus column where users input (In Process, Withdrawn and so on)and i want the user when he logs into their profile be able to update that field, they might have a value there or they might have it empty, so its either has to be insert or update i guess? can someone please take a look at it, and point me in the right direction. thank you. also i dont know if mysql version is enough or you might need something else here?  I could provide more information if needed. thanks

 

UPDATE country SET ApplicationStatus='1' WHERE ApplicationStatus=echo ('$ApplicationStatus').
IF @@ROWCOUNT=0 INSERT INTO country VALUES '$_POST[ApplicationStatus]'

 

 

Link to comment
https://forums.phpfreaks.com/topic/237748-updating-query/#findComment-1222500
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.