two names come to POSTe, they are assigned to $newName and $oldName . Why does the query to the database never arrive?

 $query = "UPDATE `img_table` SET `name` = $newName WHERE `name` = $oldName"; $updName = mysql_query($query); 
  • 3
    Well, look at the mysql error message, everything will be written there. - PinkTux
  • one
    The query seems to be syntactically correct, with the exception that you most likely do not filter the input data. If your names contain quotes, the query will not work and you can perform sql injection. And so anything can be: there is no connection to the database, there is no table or column. - mJeevas

1 answer 1

Everything is almost right with you ... if you used PDO and constructed the request, there would be no error, and since you write directly, consider the type of parameters passed: the string is passed in quotes ...

 $query ="UPDATE `img_table` SET `name` = '$newName' WHERE `name` = '$oldName'"; $updName = mysql_query($query); 
  • 2
    And then d'Artianyan will appear in the request and will break everything again. - Denis Khvorostin
  • '". $ newName."' not? - EatMyDust