Hi guys,,
I developed a Sales Management System its is a stand alone system, i installed in the Pc at first when it had few data it was working finely.
Then when data increased it started to be slow in its excution taking some seconds to complete the excution, eventually it was totally failing/timing out to complete the excution by returning back this message "Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\pharm\Admin\sale2.php on line 58".
By the way i have no idea what is the problem,,
So i need a help from you guys for any one who know where is the problem and how it can be overcomed.
The System by now is totally not working due to that,,
Thanks,

Hi,

A good point to start to investigate the issue is sale2.php on line 58, can you show us that part of code? I mean: paste the relevant code not just that line.

many dbms arent optimal
example, a flat text database that has to be entirly read, and written, anytime a recordis added or edited
as Cereal wrote, the area of code around line 58,
but add the database schema (design) to see if the bottleneck is read/write time, the disk is always the slowest process

We would need to see the code in question in order to be able to help.
What database are you using?
Do you have any indexes created on the tables?

Hi,
Am using MySQL database,
Index of course is there in the table, it is like this if you make a first Sale on the certain Item it works fine the excution goes as faster as normal.
The problem comes when you make second sale on such item again, updation process is what is timed out!
But remember when the data/records were few updating process was just fine was no timing out, and even just you reduce the record by deleting some, the process becomes fine again

Here are the codes
The last line $rizati=mysql_query($day2); is the line 58 been returned back

$selec=mysql_query("select * from perday where Itemname='$Itemname'&& Datee=CURDATE()");
  $xy=mysql_num_rows($selec);
    if($xy==0){ 
   $day="INSERT INTO perday (Itemname, Quantity, Bprice, Sprice, Proft, Datee) 
    SELECT Itemname,SUM(Quantity),SUM(Bprice),SUM(Sprice),SUM(Proft),Date  FROM solditem WHERE Itemname='$Itemname'&& Date=CURDATE()";
     $result2=mysql_query($day);
  }
   else
        {
$day2="UPDATE perday
SET Quantity = (SELECT SUM(Quantity) FROM solditem  WHERE Itemname=perday.Itemname AND Date=perday.Datee),
 Bprice = (SELECT SUM(Bprice) FROM solditem  WHERE Itemname=perday.Itemname AND Date=perday.Datee),
 Sprice = (SELECT SUM(Sprice) FROM solditem WHERE Itemname=perday.Itemname AND Date=perday.Datee),
 Proft = (SELECT SUM(Proft) FROM solditem WHERE Itemname=perday.Itemname AND Date=perday.Datee)";
 $rizati=mysql_query($day2);
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.