PDA

View Full Version : Maximum Execution Time


phpidiot
09-13-2002, 10:43 PM
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?

downsize
09-14-2002, 10:50 AM
it is a while loop, so the programmer is testing to be sure $path is empty (which it will be on its first iteration), after that it will have some data so it will fail the if() condition and $path will now be:$name . $category_separator . $path; and on for the remaining iterations of that while() loop

what is the fatal error call you are getting?