Jump to content

[SOLVED] replace


asmith

Recommended Posts

i'm really sorry guys to ask a simple mysql question here, but really i didn't find the answer .

the code is :

replace into tablename (field) values ('a');

 

but i want to replace a record in a specific row .

so i did :

 

replace into tablename (field) values ('a') where username = 'john' ;

 

but it give me syntax errors!

:-\ kinda in a hurry

 

Link to comment
https://forums.phpfreaks.com/topic/78889-solved-replace/
Share on other sites

done ! i thought update do not delete last information , just add.

is there a command to write a value beside the record ?

for example in  a table , username = john .

then  i would add "1"  in the right or left of john : 1john or john1 .

(i know i could get john, put in a variable then add 1 to it ,  any sql comand instead of 3 ,4 php lines ?)

Link to comment
https://forums.phpfreaks.com/topic/78889-solved-replace/#findComment-399284
Share on other sites

What do you mean exactly by

is there a command to write a value beside the record ?

for example in  a table , username = john .

then  i would add "1"  in the right or left of john : 1john or john1 .

You can write anything inside that quote instead of john

WHERE 'username'='john1'; or WHERE 'username'='1john'; OR WHERE 'username'='I hate you john';

Link to comment
https://forums.phpfreaks.com/topic/78889-solved-replace/#findComment-399286
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.