I have database with 80 rows currently and it increases day by day as i am conducting online lectures for doctors on every tuesday and saturday. For Members of my site, recording of these lectures are available.
My database contains columns like lecture_start_date, lecture_end_date, display_time (+45 minutes to lecture end date-time)...
currently 80 lectures recording links are available on single page. so i created pagination for 10 lectures each. code is as follows..
$sql = "SELECT COUNT(lecture_start) FROM es_lecture_master";
$rs_result = mysql_query($sql);
$row = mysql_fetch_row($rs_result);
$total_records = $row[0];
$total_pages = ceil($total_records / 10);
for ($i=1; $i<=$total_pages; $i++) {
echo "<button><a class=\"page\" href='lec_history_p.php?page=".$i."'>".$i." </a></button>";
};
And
$current_date=date("Y-m-d H:i:s");
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * 10;
$sql = "SELECT * FROM es_lecture_master where display_time <'".$current_date."' ORDER BY `lecture_start` DESC limit $start_from, 10";
$rs_result = mysql_query ($sql);
$ss=mysql_num_rows($rs_result);
$counts= sizeof($arrayreversed);
while($data=mysql_fetch_assoc($rs_result)) {
<div align="left">Lecture No :<div class="numberCircle" style="display:inline;"> <? echo $ss;?></div></div>
<table width="80%" style="text-align:left;" align="center" border="0" cellspacing="4" cellpadding="4" class="tabl">
<tr>
<td width="32%">E-Sambhasha Subject : </td>
<td ><?=stripslashes($data["lecture_subject"])?></td>
</tr>
<tr>
<td width="32%">Lecturer :</td>
<td><?=$data["lecturer_name"]?></td>
</tr>
<tr>
<td width="32%">IST Day & Date :</td>
<td><?=date("l ",strtotime($data['lecture_start']))?>,<?=date("d M Y",strtotime($data['lecture_start']));?>
</td>
</tr>
<tr>
<td width="32%" style="background-color:#d44302; color:#f4f4af;">IST Timing :</td>
<td><?=date("h:i:s A ",strtotime($data['lecture_start']))?> - <?=date("h:i:s A ",strtotime($data['lecture_end']))?></td>
</tr>
<tr>
<td width="32%">Session Recording :</td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabl"><tr>
<td width="26%">
<button data-fancybox-href="<?php echo $data['recording_link'];?>" class="fancy fancybox.iframe more_info_btn" >Play Recording</button> </td>
</tr></table>
</td>
</tr>
</table>
</div>
With This Code I am getting result as following image.
But I don't want to show serial numbers for pagination but want to show date range of lectures conducted for pagination...e.g. button with label ="From 13 March 2014 To 7 Jan 2014" (here 13 march will be lecture start date of Lecture shown on Top on page 1) instead of Button "1", button with label = "From 06 Jan 2014 To 12 October 2014" Instead of Button with label "2"? (database contains lecture_start_date and lecture_end_date columns)
Also in Lecture No., on every page it shows Lecture No. 10 to 1..instead of that how to show like on page 1 Lecture 80 to 70, on page 2 - lecture no. 70 to 60 and so on.. ?
see image -