function loadIngredients($id) { $result_fields = array("ingredient_id", "quantity"); $table = "RecipeIngredient"; $eid = new stdClass(); $eid->column = "recipe_id"; $eid->compare = "="; $eid->logical = ""; $eid->value = $id; $query_params = array($eid); $con1 = new SQLconnection(); $obj = $con1->pdo_query_wparam($result_fields, $table, $query_params); if (!empty($obj)) { foreach ($obj->results as $ing) { $ingredient = new Ingredient($ing->ingredient_id); $ingredient->setQuantity($ing->quantity); array_push($this->ingredients, $ingredient); } } else { array_push($this->ingredients, "No Ingredients available"); } }