[thelist] PHP/MySQL results in multiple table cells?

Michael Pemberton mpember at phreaker.net
Fri Sep 28 08:45:59 CDT 2001


Without seeing your code, I am guessing as to the layout of your page.
Anyway, here's an example of some code I recently used for a similar
result.

    $newData=array(); // this is where the data will be stored

    mysql_connect("localhost");
    $result=mysql_db_query("cdcollection",$query);
    $num_rows=mysql_num_rows($result);
    $num_fields=mysql_num_fields($result);
    for ($i=0; $i<$num_rows; $i++)
$newData[]=mysql_fetch_array($result);

Here's hoping this is helpful.

Michele Wandrei wrote:

> <slowly emerging from lurk mode>
>
> I'm working on a PHP/MySQL project for a friend who is a logo
> designer.  His site will include a portfolio section where
> potential clients can see his work.  He wants to include one page
> that will show thumbnail images of all of the portfolio images --
> clicking on the thumbnail will take you to the full size image.
> That in itself is a pretty easy task.  The challenge was that he
> wants to show the thumbnails in a table with three cells in each
> row.
>
> I got it to work quite nicely, but I ended up looping through the
> query getting 3 images each time, then dropping them into the
> table cells.  Since the query is in the loop, that can add up to
> a lot of queries!
>
> It seems like there must be an easier way to do this.  Is there a
> way to run one query, then loop through the results array three
> rows at a time?
>
> Thanks!
>
> <slinking back to lurk mode>
> ___________________________________________________
> Michele Wandrei
> inThree Design
> www.inthree.com
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !

--
Michael Pemberton
mpember at phreaker.net
ICQ: 12107010








More information about the thelist mailing list