Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

retrieving data from db

Links for php scripts

Moderators: macek, egami, gesf

retrieving data from db

Postby darrenclaveria » Wed Sep 19, 2012 2:10 am

pls help me. how can i retrieve data from my database and GROUP it by 5. like the one that attached. if its more than 5, an number below(page number) will appear and have a link to other group of data. hope you will understand and help me. thank you in advance
Attachments
d.jpg
how to do this? :(
d.jpg (65.39 KiB) Viewed 345 times
darrenclaveria
New php-forum User
New php-forum User
 
Posts: 3
Joined: Fri Sep 07, 2012 11:11 am

Re: retrieving data from db

Postby freshnet » Wed Sep 19, 2012 5:27 am

You can't do this with the SQL, you'd need to return the result set and create a new page for every 5 rows. The best way to do that probably is to have a row counter variable that increments every time you output a result, and create a new page when that variable gets to 5, then reset the variable to 1.
User avatar
freshnet
php-forum Active User
php-forum Active User
 
Posts: 252
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: retrieving data from db

Postby darrenclaveria » Wed Sep 19, 2012 6:13 am

i still dont know what approach gonna use :(
darrenclaveria
New php-forum User
New php-forum User
 
Posts: 3
Joined: Fri Sep 07, 2012 11:11 am

Re: retrieving data from db

Postby TomCornar » Fri Sep 21, 2012 2:47 am

hi,you have to use pagination .check this link,

http://www.roseindia.net/sql/mysql-example/pagination.shtml

hope this helps.

Regards,
Tom Cornar
Trinay Technology Solutions
http://www.trinay.com
User avatar
TomCornar
New php-forum User
New php-forum User
 
Posts: 25
Joined: Fri Sep 14, 2012 12:06 am

Re: retrieving data from db

Postby BrianAlan » Wed Sep 26, 2012 5:45 pm

a row counter variable that increments every time you output a result, and create a new page when that variable gets to 5, then reset the variable to 1.





-------------------------------
http://www.wholesaledvdsales.co.uk/
BrianAlan
New php-forum User
New php-forum User
 
Posts: 6
Joined: Mon Aug 13, 2012 2:03 am


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.