-1

I am have a page in which i have to show all the records from my data base but its taking alot of time when i refresh it. The html part loads fast but where the cursor reaches my mysql query it takes a lot of time to load.. here is my query

$srchresult = mysql_query("SELECT `date`,`chalno`,`custcode`,`vessel`,`rankcode`,`crew`,`ppno`,`cdcno` FROM `$maindb` WHERE `series`='$zseries' Order By `date`, `chalno` desc")or die(mysql_error());
                                while ($row = mysql_fetch_array($srchresult)) {
                                    $mdate = strtotime("d-m-Y", $row[date]);
                                    echo "<tr>";
                                    echo "<td align='left'>$mdate</td>";
                                    echo "<td align='left'>$row[chalno]</td>";
                                    echo "<td align='left'>$row[custcode]</td>";
                                    echo "<td align='left'>$row[vessel]</td>";
                                    echo "<td align='left'>$row[rankcode]</td>";
                                    echo "<td align='left'>$row[crew]</td>";
                                    echo "<td align='left'>$row[ppno]</td>";
                                    echo "<td align='left'>$row[cdcno]</td>";
                                    echo "<td align='left'><a href=\"$file?mode=edit&$keyfld=$row[$keyfld]&series=$zseries\"><i class='fa fa-pencil' style='font-size:1.3em;color:#00C0EF;cursor:pointer;'></i></a></td>";
                                    echo "</tr>";
                                }
                            }

1 Answers1

1

I strongly recommend using pagination in order to be able to render/browse trough 10k records on a page.

If you must do it without a visible pagination block in your layout then use an infinite scroll solution. Here is a rather simple one: http://www.infotuts.com/ajax-infinite-scroll-using-jquery-php-mysql/

Your mysql query is fine, even though you should use at least PHP's mysqli extension (http://php.net/manual/en/intro.mysqli.php) to retrieve the data.