function get_jd_table(){
try
{
$result = $GLOBALS['conn']->query('SELECT * FROM jdhtmlcontroller');
}
catch (PDOException $e)
{
echo 'Error fetching data from the database!';
exit();
}
$val = $result->fetchAll();
}
// calling function
get_jd_table();
I want to loop through the data that is stored in $val variable. any idea anyone?
Hi joeboo,
How about something like this:
$rows = get_jd_table();
foreach ($rows as $row) {
// Output your table rows here, or whatever..
}
Why didn’t I think of that! lol. thanks, it works now!