[How to create] – Pagination Without Database MySQL on PHP

May be seen from the title of this post is not familiar to the developers of web -based software.  Make pagination is a must when we have data that can be said to be tens or even hundreds of thousands of web pages. Why should? because how could we be able to access tens or even hundreds of thousands of data on a single page. inefficient is not it?. The following simple code syntax that may be re-developed.

$data = array(
	array('001','AAA'),
	array('002','BBB'),
	array('003','CCC'),
	array('004','DDD'),
	array('005','EEE'),
	array('006','FFF'),
	array('007','GGG'),
	array('008','HHH'),
	array('009','III'),
	array('010','JJJ'),
	array('011','KKK'),
	array('012','LLL'),
	array('013','MMM'),
	array('014','NNN'),
	array('015','OOO'),
	array('016','PPP'),
	array('017','QQQ'),
	array('018','RRR'),
	array('019','SSS'),
	array('020','TTT'),
);

$batas = 10; # FOR LIMIT DATA
$halaman = @$_GET['halaman'];

if(empty($halaman)){
 $posisi = 0;
 $halaman = 1;
 $hingga = $batas;
}else{
 $posisi = ($halaman - 1) * $batas;
 $hingga = $posisi + $batas;
}

$no = $posisi + 1;
$total_data = count($data);

echo '<table cellpadding="4" cellspacing="0" border="2">
 <thead>
 <tr style="background:#000;color:#FFF;">
 <th>No</th>
 <th>Angka</th>
 <th>Huruf</th>
 </tr>
 </thead>
 <tbody>';

 while($posisi < $hingga){

 echo '<tr>
 <td align="center">'.$no.'</td>
 <td>'.$data[$posisi][0].'</td>
 <td>'.$data[$posisi][1].'</td>
 </tr>'; 

 $posisi++; 
 $no++; 
 }
 echo '</tbody>
 </table>';

$jumlah_halaman = ceil($total_data/$batas);
 
echo"<br> Halaman : ";

for($i=1; $i<=$jumlah_halaman; $i++){
 if($i != $halaman){
 echo"<a href=\"sample_paging.php?halaman=$i\">$i</a> | ";
 }else{
 echo"<b>$i</b> | ";
 }
}
 
 echo "<p>Total data : <b>$total_data</b> </p>";

Save the file sample_paging.php on your directory web server and then run in web browser.

if you click next page then display data.

hopefully useful, please try and develop with your version. Bye..bye.

[How to solve] – Fatal error : Maximum execution time of 300 seconds exceeded

Sometimes when we want to learn a source code to the database we are given an SQL dump to be studied again. Some time ago, I was studying the structure of the data from MySQL given by my friend. However I find this error message when I try to import them to my device.  “Fatal error : Maximum execution time of 300 seconds exceeded” . as seen in the picture. Happen to my office devices using windows.

Maximum-execution-time-of-300-seconds-exceeded

After I trace the error message, I know why it happened. and it turns out the default PHPMyAdmin configuration. And then open this file xampp\phpmyadmin\config.inc.php . Search line code and set value :

$cfg['ExecTimeLimit'] = 6000;

And then open this file xampp\php\php.ini . Search line code and set value this according to the needs.

post_max_size = 128M
upload_max_filesize = 128M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 128M

And then open this file xampp\mysql\bin\my.ini . Search line code and set value this according to the needs.

max_allowed_packet = 200M

Do not forget to save all configurations. Please restart the web server and the database server.  You can tried to import data SQL. If there are criticisms and suggestions, or a more serious problem on this matter, you can tell me. I hope be useful.