Hello Peeps,
I have a PDO query that I have put into a function. However i’m confused as to how I output the values in the funtion so they can be returned and echoed to my page ie:
function dbQuery ($dbc) {
$QUERY = $dbc->query("SELECT * from table");
$QUERY->setFetchMode(PDO::FETCH_ASSOC);
$ROW = $QUERY->fetch();
$output = $ROW['name'];
$output = $ROW['age'];
$output = $ROW['weight'];
$output = $ROW['height'];
return $output;
}
Then on my page display them
<? // Somehow grab contents of $output from the function and display individually??;?>
Name: <?php echo $ROW['name'];?><br />
Age: <?php echo $ROW['age'];?><br />
Weight: <?php echo $ROW['weight'];?><br />
Height: <?php echo $ROW['height'];?><br />
Thanks