game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online

paging using php

paging using php


<?
//pagging info
// how many rows to show per page
$rowsPerPage = 2;
// by default we show first page
$pageNum = 1;
// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
//here u can see the  $offset, $rowsPerPage is used to control the result
$chkCat = "SELECT * FROM `complaint_category` WHERE `pid` = 0 LIMIT $offset, $rowsPerPage";
$chkCatExe = mysql_query("$chkCat");
// how many rows we have in database
$query   = "SELECT * FROM `complaint_category` WHERE `pid` = 0";
$result  = mysql_query($query);
$row     = mysql_num_rows($result);
$numrows = $row ;
// how many pages we have when using paging?
$maxPage = ceil($numrows/$rowsPerPage);
$maxPage = 50;
// print the link to access each page
$self = $_SERVER['PHP_SELF'];
$nav  = '';
$maxPageNext = $pageNum + 5;
$maxPageBefore = $pageNum - 5;
$nav = "$pageNum ";
for($page = $pageNum+1; $page <= $maxPageNext; $page++)
{
if($page <= $maxPage)
{
$navafter .= " <a href=\"$self?page=$page\" class=\"PrevNext\">$page</a> ";
}
}
for($page = $pageNum-5; $page < $pageNum; $page++)
{
if($page >= 1)
{
$navbefore .= " <a href=\"$self?page=$page\" class=\"PrevNext\">$page</a> ";
}
}
$nav = $navbefore . $nav . $navafter ;
if ($pageNum > 1)
{
$page  = $pageNum - 1;
$prev  = " <a href=\"$self?page=$page\" class=\"activePrevNext\">[Prev]</a> ";
$first = " <a href=\"$self?page=1\" class=\"activePrevNext\">[First Page]</a> ";
}
else
{
$prev  = '&nbsp;'; // we're on page one, don't print previous link
$first = '&nbsp;'; // nor the first page link
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$next = " <a href=\"$self?page=$page\" class=\"activePrevNext\">[Next]</a> ";
$last = " <a href=\"$self?page=$maxPage\" class=\"activePrevNext\">[Last Page]</a> ";
}
else
{
$next = '&nbsp;'; // we're on the last page, don't print next link
$last = '&nbsp;'; // nor the last page link
}
// print the navigation link
echo $first . $prev . $nav . $next . $last;
?>
See the above code i am uisng php for pagging.

Here u can see how php is used to display the pagging all the lines are well comneted to see demo please click pagging using php

Get full web page URL from address bar

Get full web page URL from address bar

In this Artical, we will learn how to get current web page url from your web browser address bar using php script.

Syntax
<?php
$url=”http://”.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo $url;
?>
Overview
In this tutorial, you’ll learn 2 functions in php to get full url from address bar.

1. $_SERVER['HTTP_HOST']
2. $_SERVER['REQUEST_URI']

$_SERVER['HTTP_HOST'] this function will show only server name.
$_SERVER['REQUEST_URI'] this function will show you the path to file of your url.

In the image is a url from apple website. When you run $_SERVER['HTTP_HOST']; you’ll get result “www.apple.com” only, no “http://” no “/downloads/dashboard/email_messaging/todo.html”

<?php
$server=$_SERVER['HTTP_HOST'];
echo $server;
?>

You’ll get this is result
www.apple.com

When you run this script “$_SERVER['REQUEST_URI']” you’ll get the result below, no “http://” and no “www.apple.com

<?php
$request_url=$_SERVER['REQUEST_URI'];
echo $request_url;
?>
This is result when you run $_SERVER['REQUEST_URI']
/downloads/dashboard/email_messaging/todo.html

To get full URL from this site you, we have to use (.) to connect 2 functions together and create http:// by yourself.
<?php
$url=”http://”.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo $url;
?>

how to sort php array highest to lowest php





how to sort php array highest to lowest php

Hi i want to sort php array from highest to lowest for that simple problem i used sort and rsort together..

$ides = explode(‘:’,$_GET[id]);
//using explode i am creating array

sort($resumeId);

rsort($resumeId);

So result will a array with highest on top and lowest on last..

thanks

mrphpguru