shashib Posted April 7, 2014 Share Posted April 7, 2014 I have 4 Column ( id (primary) , a, b ,c ,d ) --------------------------------------------------------------------------------------------------------------------------------ID | A | B | C ( where C = SUM B ) | D ( where D = C / A1 , Where A1 = 6 )-------------------------------------------------------------------------------|------------------------------------------------1 | 4 | 3 | 8 | 22 | 6 | 2 | | 3 | 1 | 3 | | -------------------------------------------------------------------------------|-------------------------------------------------- How i can display such table with pagination . Both A , B value are Input text Field , which entry are made by user side and its stored in Database table , but C value is addition of B (TOTAL) . where C = SUM B where D = C / A1 , Where A1 = 6 HENCE how i can get C,D as A,B coloumn get increment , and c,d will be calculation of it , hence how i can show such TABLE VIEW with Pagination . note : Not tried any thing , as i am bit confuse how to start Link to comment Share on other sites More sharing options...
guruparthi Posted July 4, 2014 Share Posted July 4, 2014 You need to learn only few things first in pagination concept. 1. You get page no. 2. find limit, number of results shows on each page and starting point 3. total number of records 4. then make query and display result <?phperror_reporting('E_ALL ^ E_NOTICE');mysql_connect('localhost','root','') or die(mysql_error());mysql_select_db('new') or die(mysql_error());$page=$_REQUEST['p'];$limit=10;if($page==''){ $page=1; $start=0;}else{ $start=$limit*($page-1);}$query=mysql_query("select * from table1 limit $start, $limit") or die(mysql_error());$tot=mysql_query("select * from table1") or die(mysql_error());$total=mysql_num_rows($tot);$num_page=ceil($total/$limit);echo'<table><th>Reg.Id</th><th>Name</th><th>Category</th>';while($res=mysql_fetch_array($query)){ echo'<tr><td>'.$res['game_ID'].'</td><td>'.$res['game_Title'].'</td><td>'.$res['category_Name'].'</td></tr>';}echo'</table>';function pagination($page,$num_page){ echo'<ul style="list-style-type:none;">'; for($i=1;$i<=$num_page;$i++) { if($i==$page){ echo'<li style="float:left;padding:5px;">'.$i.'</li>';}else{ echo'<li style="float:left;padding:5px;"><a href="pagination.php?p='.$i.'">'.$i.'</a></li>';} } echo'</ul>';}if($num_page>1){ pagination($page,$num_page);}?> Reference: http://www.phponwebsites.com/2014/04/php-mysql-pagination.html Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now