1

I would like to know how to overwrite a value like example if someone want to change from the Enjin website and want my database to update. So from the JSON I get the value of all the member and the name and insert it to my database.

With this :

$sql = "INSERT IGNORE INTO test (id, name) VALUES('$key','$name')";

But the problem is it doesn't update the name if the guy change it on the website and I'm not sure if someone register to the website if the member will by added automatically when this query is use. I think it's going to work but I'm not sure.

(I use JSON to get the data out of the website with the API)

Thanks in advance!

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141

1 Answers1

5

try

$sql = "INSERT INTO test (id, name) VALUES('$key','$name') ON DUPLICATE KEY UPDATE name=VALUES(name)";
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Abi
  • 174
  • 1
  • 4