Error PHP line quotes [closed]

-3

I have an error in the quotes of this sentence of MySQL in PHP, since the LIMIT does not take it as such, I hope your help.

$sqlP = 'SELECT * FROM coleccionPublicaciones WHERE 
id_publicacion='.$row["id_publicacion"].' LIMIT 1';
    
asked by MadCode 03.07.2018 в 15:03
source

1 answer

1

The problem is in the single quotes where you declared your query. Remember that the use of these is for only strings, if you have any variable within the string double quotes are used and everything inside this variable included with single quotes.

Your query should look like this:

$sqlP = "SELECT * FROM coleccionPublicaciones WHERE 
id_publicacion='.$row["id_publicacion"].' LIMIT 1";

More info by clicking aca

    
answered by 03.07.2018 в 15:12