Jump to content

Data not printing in table


cmgmyr

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.