-
1 Attachment(s)
CGI Timeout in PHP
Hi,
I'm having problems with mySQL+PHP stuff...
My problem is next kind of
Have one table where i'm storing users which are related to each other like tree foundation.
So, via php i'm using recursion function to collect and made tree of users that
mach to specify user from beging of starting function.
Problem actully is that this code was working greate and
after rebooting my PC it wan't work at all.
First I was getting error message that mySQL can't allocate 10K and
now always geting after sometime / 5 min. or so 'CGI Timeout The specified
CGI application exceeded the allowed time for processing. The server
has deleted the process'.
I'm using PHP 4.1.1 and mySQL 3.23.51 under Windows 2000 Server Edition.
I'm sending SQL script file with data and php code that should work but not working.
Please is there someone who can help me with this...
Thanks.
-
ok for one you have an infinite loop in that function.
PHP Code:
function userlist($accountid,$padspace=0,$padingnum=5) {
$sqlquery = "SELECT * FROM clan WHERE parentid= '$accountid' ORDER BY datumulaza ASC";
$result = mysql_query($sqlquery);
$number = mysql_num_rows($result);
$ret=array();
if ($number>0) {
$i=0;
$n=0;
for ($i=0; $i<$number; $i++) {
$x=array();
$x[0]=mysql_result($result,$i,"accountid");
$x[1]=mysql_result($result,$i,"hcid");
$x[2]=mysql_result($result,$i,"imeprezime");
$x[3]=mysql_result($result,$i,"parentid");
$x[4]=$padspace;
$n=count($ret);
$ret[$n]=$x;
$setpadspace=$padspace+$padingnum;
$tmp=userlist($x[0],$setpadspace);
if (!empty($tmp) && count($tmp)>0) {
$ret=array_merge($ret,$tmp);
}
}
}
every time you go in the funtion it gets teh variables, then you get to this line "$tmp=userlist($x[0],$setpadspace);" and it calls the funtion again which resets everything back to 0 for which you add again to just go back again.
what in tarntion are you trying to do anyway? all I see happening is you get a list of ID's and put them in the drop down menu.
and take those stupid ` off the table names in the sql file.
-
1 Attachment(s)
well just to add picture to be sure how shold looks like results from php script... not same but quite engoug....
-
sorry peps times goes out
I solve the problem.... it wasn't problem with code at all
Just data in database hhhe :)