cmgmyr Posted August 9, 2007 Share Posted August 9, 2007 I have this script: <?php $table = "<table border=1>\n"; $sql = "SELECT id FROM categories LIMIT 1"; $result = $db->query($sql); while($row = $db->fetch($result)){ $id = $row['id']; $table .= " <tr> <td>$id</td> <td>".$catalog->crumbs_category2($id)."</td> </tr> "; } $table .= "</table>"; echo $table; ?> <?php function crumbs_category2($cat_id, $level=0) { global $db; $sql = "SELECT parentid, name FROM categories WHERE id = $cat_id"; $result = $db->query($sql); list ($p, $n) = $db->fetchRow($result); if ($p != '0') $this->crumbs_category2($p, $level+1); echo ($p == '0') ? "$n " : "- $n "; } ?> and it outputs this: Fashion Jewelry <table border=1> <tr> <td>1</td> <td></td> </tr> </table> Why is this data not printing in the table? Thanks! Link to comment https://forums.phpfreaks.com/topic/64148-data-not-printing-in-table/ Share on other sites More sharing options...
Barand Posted August 9, 2007 Share Posted August 9, 2007 your function isn't returning anything to be echoed Link to comment https://forums.phpfreaks.com/topic/64148-data-not-printing-in-table/#findComment-319700 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.