Concatenate variable php with sql query


It does not let me concatenate the following query, it throws me error

$consulta_url="select url from urlspeliculas where idioma='$idiomas[$f][$g]'";

the last bracket in $ languages [$ f] [$ g] I take it as text, some solution?

asked by Orlando Pasaca Rojas 29.01.2018 в 03:24

1 answer


A quick solution, but not the optimal one, would be to modify your code in the following way:

$idioma = $idiomas[$f][$g];
$consulta_url = "select url from urlspeliculas where idioma = '$idioma'";

In this way you would capture the value of the array index within the variable $ language and then you would pass this as a string within $ query_url.

If the error persists, it would be interesting to know the content of it.

I hope you help, greetings.

answered by 29.01.2018 / 03:39