0) { $current_page = $_GET['page']; } else { $current_page = 1; }
$number_of_pages = 1;
$rows_to_show = 4; // number of items you want displayed on each page
$my_query = "SELECT * from ali_testimonials ORDER by date_added desc"; // the query you are performing
// do paging math
$Result = mysql_query($my_query);
if ($Result) {
$number_of_rows = mysql_num_rows($Result);
// figure how many total pages
$number_of_pages = floor($number_of_rows / $rows_to_show);
$remaining_number_of_data = $number_of_rows % $rows_to_show;
if ($remaining_number_of_data >= 1) {
$number_of_pages = $number_of_pages + 1;
}
// create page navigation links at bottom of table, as needed
if ($number_of_pages <= 1) {
$page_navigation .= "";
} else {
for ($i=1; $i<=$number_of_pages; $i++) {
if ($i == 1) { // start with PREV button
if ($current_page <= 1) { $prev_number = 1; }
else { $prev_number = $current_page - 1; }
$page_navigation .= "previous ";
}
if ($i == $current_page) { // bold current page
$page_navigation .= "".$i." ";
} else {
$page_navigation .= "".$i." ";
}
if ($i == $number_of_pages) { // end with NEXT button
if ($current_page >= $number_of_pages) { $next_page = $number_of_pages; }
else { $next_page = $current_page + 1; }
$page_navigation .= "next";
}
}
}
}
// set starting point for database query
if ($current_page == 1) { $start_row = 0; }
else { $start_row = $rows_to_show * ($current_page-1); }
// now, get only rows to be displayed
$Result = mysql_query($my_query." LIMIT ".$start_row.", ".$rows_to_show);
if ($Result) {
echo'';
$i=0;
/// loop content here ////////////////
// loop through results & build table rows
while ($itemArray = mysql_fetch_array($Result))
{
$text = substr($itemArray['comments'],0,180); //this take the first 300 characters from the decription of the news item
if($i%1==0)
echo'
";
}
mysql_free_result($Result);
echo '
'; // the top page navigation } if ($type=="written_details") { /// put in lists here......./////////////////////////////////////////////////////////////////////////////////////////////////////// $id = $_GET['id']; $my_query = "SELECT * from ali_testimonials where id = '$id' ORDER by date_added desc"; // the query you are performing $Result = mysql_query($my_query); if ($Result) { echo'';
$i=0;
/// loop content here ////////////////
// loop through results & build table rows
while ($itemArray = mysql_fetch_array($Result))
{
if($i%1==0)
echo'
";
}
mysql_free_result($Result);
}
else if ($type=="video_list")
{
/// put in lists here.......///////////////////////////////////////////////////////////////////////////////////////////////////////
// initialize paging options
if (strlen($_GET['page'])>0) { $current_page = $_GET['page']; } else { $current_page = 1; }
$number_of_pages = 1;
$rows_to_show = 4; // number of items you want displayed on each page
$my_query = "SELECT * from ali_video where video_subs_id = '10' ORDER by date_added desc"; // the query you are performing
// do paging math
$Result = mysql_query($my_query);
if ($Result) {
$number_of_rows = mysql_num_rows($Result);
// figure how many total pages
$number_of_pages = floor($number_of_rows / $rows_to_show);
$remaining_number_of_data = $number_of_rows % $rows_to_show;
if ($remaining_number_of_data >= 1) {
$number_of_pages = $number_of_pages + 1;
}
// create page navigation links at bottom of table, as needed
if ($number_of_pages <= 1) {
$page_navigation .= "";
} else {
for ($i=1; $i<=$number_of_pages; $i++) {
if ($i == 1) { // start with PREV button
if ($current_page <= 1) { $prev_number = 1; }
else { $prev_number = $current_page - 1; }
$page_navigation .= "previous ";
}
if ($i == $current_page) { // bold current page
$page_navigation .= "".$i." ";
} else {
$page_navigation .= "".$i." ";
}
if ($i == $number_of_pages) { // end with NEXT button
if ($current_page >= $number_of_pages) { $next_page = $number_of_pages; }
else { $next_page = $current_page + 1; }
$page_navigation .= "next";
}
}
}
}
// set starting point for database query
if ($current_page == 1) { $start_row = 0; }
else { $start_row = $rows_to_show * ($current_page-1); }
// now, get only rows to be displayed
$Result = mysql_query($my_query." LIMIT ".$start_row.", ".$rows_to_show);
if ($Result) {
echo'';
$i=0;
/// loop content here ////////////////
// loop through results & build table rows
while ($itemArray = mysql_fetch_array($Result))
{
if($i%1==0)
echo'
";
}
mysql_free_result($Result);
echo '
'; // the top page navigation } else if ($type=="details") { //// put in details here...... $video_id = $_GET['video_id']; $my_query = "SELECT * from ali_video where video_id = '$video_id'"; // the query you are performing $rs = mysql_query($my_query); $itemArray = mysql_fetch_array($rs); echo''; } else if ($type=="submit_testimonial") { ?>
Written Testimonials - Page '.$current_page.'
'; echo ''.$page_navigation.'
'; // the top page navigation
echo'';
if($itemArray['tn_image']!="")
{
echo'
|
';
$i++;
if($i%1==0)
echo '
'.$page_navigation.'
'; // the top page navigation } if ($type=="written_details") { /// put in lists here......./////////////////////////////////////////////////////////////////////////////////////////////////////// $id = $_GET['id']; $my_query = "SELECT * from ali_testimonials where id = '$id' ORDER by date_added desc"; // the query you are performing $Result = mysql_query($my_query); if ($Result) { echo'
Written Testimonials Details
'; echo'';
echo'
|
';
$i++;
if($i%1==0)
echo '
Video Testimonials - Page '.$current_page.'
'; echo ''.$page_navigation.'
'; // the top page navigation
echo'';
echo'
|
';
$i++;
if($i%1==0)
echo '
'.$page_navigation.'
'; // the top page navigation } else if ($type=="details") { //// put in details here...... $video_id = $_GET['video_id']; $my_query = "SELECT * from ali_video where video_id = '$video_id'"; // the query you are performing $rs = mysql_query($my_query); $itemArray = mysql_fetch_array($rs); echo''; } else if ($type=="submit_testimonial") { ?>

