Skip to main content
Topic: Query page_id (Read 2286 times) previous topic - next topic

Query page_id

Good morning,
I'm inserting a custom sql query to create a drop-down menu in the form of an add page, but even though the query is correct, when I start the page it doesn't work, it seems like it doesn't recognize the $page_id variable.

The query without $page_id filter (works correctly and returns me all records):

"SELECT DISTINCT dr.id_distinta, dr.id_fase AS value, caf.codice AS label FROM line_list dr JOIN cfg_anagrafica_fasi caf ON dr.id_fase = caf.id"

The query with $page_id filter doesn't work:

"SELECT DISTINCT dr.id_distinta, dr.id_fase AS value, caf.codice AS label FROM line_list dr JOIN cfg_anagrafica_fasi caf ON dr.id_fase = caf.id WHERE dr.id_distinta = $page_id"

I can't understand the error

Thanks for the help