Skip to Content

php problem

I'm learning php and Mysql , i'm copy script for teaching from project professional book whatever when running this script :

<?php
$host="localhost";
$dbusername="root";
$dbpassword="root";
$database="books";
$x=mysql_connect("localhost","root","root") or die(mysql_error());


$x2=mysql_select_db($books);

if (empty ($category))
{
$category=1;
}
$childval=$category;
$query = "Select categoryid,name from categroy where categoryid=\"".$childval."\"";
$result=mysql_query($query);
if ([email protected]_fetch_array($result))
{
 $catid[1]=$row["categoryid"];
 $catname[1]=$row["name"];
}
while (!($childval==0))
{
 $query="select parentcategoryid from category where categoryid=\"".$childval."\"";
$result=mysql_query($query);
if ([email protected]_fetch_array($result))
{
    $childval=$row["parentcategoryid"];
    $query="select categoryid,name from category where categoryid=\"".$childval."\"";
    $result=mysql_query($query);
    if($row=mysql_fetch_array($result))
    {
        $catid[]=$row["categoryid"];
        $catname[]=$row["name"];
 }
}
}

for ($i=count($catname);$i>0;$i)
{
    echo "<A href=visitor.php?category=".$catid[$i].">".$catname[$i]."</a>>";
}
?>

The problem appears :Fatal error: Maximum execution time of 180 seconds exceeded in C:\AppServ\www\project.php on line 32

Pronco's picture

Should be the cause.

Hello,

Increase your php.ini max_execution_time from 180 to 300 seconds and restart your Appserv. See if that helps

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


Dr. Radut | forum