I've a problem with a script which I've downloaded. It run well just then but when I've entered quite a number of record in my database, the script give me the fatal error call. This is snippet which is causing the error but I can't figure out how to optimize it.
Any help is greatly appreciated.
function ShowCategoryPath($cat) {
global $category_separator;
$parent_id = 1000;
while($parent_id) {
// read name and parent_id
$query = "select * from category where category_id=$cat";
$result = mysql_query($query);
$parent_id = mysql_result($result,0,'parent_id');
$name = mysql_result($result,0,'name');
// write path
if(empty($path)) {
$path = $name;
}
else {
$path = $name . $category_separator . $path;
}
// next looping
$cat = $parent_id;
}
return $path . " ";
}
I don't understand where the $path came from. Any idea?