How do i display mysql data in a 5 column 5 row table ? - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-04-2008, 01:24 PM   #1 (permalink)
Junior Member
 
Join Date: Nov 2008
Posts: 6
Default How do i display mysql data in a 5 column 5 row table ?

Hi,

i am trying to display data from a mysql database in a HTML table in a certain way, i can get the data to display in a one column list but i require the data to display in a five column five row table, any ideas on how i can go about doing this ?

P.S. i use PHP to call the mysql data.

Thanks,
Mark H.
toasty525 is offline   Reply With Quote
Sponsored Links
Old 11-04-2008, 03:31 PM   #2 (permalink)
Junior Member
 
Join Date: Nov 2008
Posts: 6
Default Found a solution

I found a solution to the above problem and its this:

PHP Code:
      <?php
      $i
=0;
    
$members mysql_query("select * from members");
    echo 
'<table><tr>';
    while (
$row mysql_fetch_row($members)) {
     
$i++;
      if (
$i == 0) {
        echo 
'<td>'.$row[1].'<br><img src="'.$row[3].'" width=45 height=45></td></tr><tr>';
    }else{
        echo 
'<td>'.$row[1].'<br><img src="'.$row[3].'" width=45 height=45></td>';
      }
    }
    echo 
'</tr></table>';
?>
Any ideas how to limit the table to just 5 rows of 5 columns and then display a link that when clicked displays another table of 5 rows of 5 columns with the next lot of data in it ?
toasty525 is offline   Reply With Quote
Old 11-09-2008, 09:48 PM   #3 (permalink)
Junior Member
 
Join Date: Oct 2008
Location: Stuck on windows 3.1
Posts: 26
Default Re: How do i display mysql data in a 5 column 5 row table ?

Yes. This is called paginating. Unfortunately I cant find any online sources. I have read this good book by larry ullman and you might want to try and see his website because he puts the scripts from the book into his website.

Digital Media and Communications Insights, Inc.::Home Page

You just go to the third edition and it has a lot of sample scripts.
The book is copyrighted therefore I cant give you any advice on the code. You will just have to fathom it out. But he comments the stuff very well.

Good luck
fireworking is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 07:27 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting