Skip to content
Advertisement

Facing Syntax error in SQL query

    $query = "UPDATE `$database`.`$member` SET `email` = '$rowmem['email']' WHERE `id` = $rowmem['mem_id']";

I don’t know why but this line is showing an error in my page.

It’s said there is an syntax error.

Can anyone correct it ??

Advertisement

Answer

    $query = "UPDATE `$database`.`$member` 
              SET `email` = '".$rowmem['email']."' 
              WHERE `id` = ".$rowmem['mem_id'];

I am sure it will be correct one.

Basically you added slashes which are not needed but you need to do concatenation.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement