PHPRad Classic Initial 2.7.3 Forum

PHPRad Forum => General Discussion => Topic started by: giulio on February 06, 2024, 07:11:10 AM

Title: Query page_id
Post by: giulio on February 06, 2024, 07:11:10 AM
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