I have several similar queries as you can see below.
I was hoping I could create one function to cover all the queries by just substituting the different field as a parameter, but I can't figure out how to do this with the queries in thier current form. Is there a way of doing this?
Code: Select all
$dbdiet = pg_query($connection, "SELECT get_diet(diet) as diet FROM diet_owner where owner=$uid ORDER BY diet");
$dbunit = pg_query($connection, "SELECT get_unit(unit) as unit FROM unit_owner where owner=$uid ORDER BY unit");
$dbing = pg_query($connection, "SELECT get_ingredient(ingredient) as ingredient FROM ingredient_owner where owner=$uid ORDER BY ingredient");
$dbpp = pg_query($connection, "SELECT get_preprep(preprep) as preprep FROM preprep_owner where owner=$uid ORDER BY preprep");