I am running into some performance issue with php and mysql page.
i have a code like
mysql statement
while loop fetching the record
{
foreach($somearray)
{
Another mysql statement while fetch records using a where clause using $somearray key and 1st while loop result row data.
}
}
/*end while*/
the mail statement takes 462 records and second foreach runs 12 times. The page loads very slowly and when i comment the second mysql statement it loads fast.
So what measures should i take so as to fetch data faster and any solution for this?
/** Question Update **/
one table is in row manner i.e say primary ID is main for this.
second table the data is in multiple rows i.e same ID from 1st table will have multiple rows and i need to fetch only particular months data from the second table and join both of this and show in a table.
So i am using that foreach to loop through months.
$somearrayto another mysql statement that will work with the first result set?