RE: [PHP] loop structure(SOLVED)

From: Date: Sat, 09 Sep 2006 16:15:18 +0000
Subject: RE: [PHP] loop structure(SOLVED)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-241540@lists.php.net to get a copy of this message
Thx, it works like a charm I think the mysql_fetch_assoc was the thing I was looking for. -----Oorspronkelijk bericht----- Van: Robert Cummings [mailto:robert@interjinn.com] Verzonden: zaterdag 9 september 2006 17:36 Aan: rv@domos.be CC: php-general@lists.php.net Onderwerp: Re: [PHP] loop structure Untested... ... ... <?php if( ($result = mysql_query( $query )) === false ) { // do something other than die you lazy ass programmers. } else { $hits = mysql_num_rows( $result ); $cols = 3; $rows = ceil( $hits / $cols ); for( $i = 0; $i < $rows; $i++ ) { for( $j = 0; $j < $cols; $j++ ) { $picture = ''; if( ($item = mysql_fetch_assoc( $result )) !== false ) { echo '<td width="120" valign="top">' .$item['picture'] .'</td>' .'<td width="13" valign="top">' .'<!--DWLayoutEmptyCell-->&nbsp;' .'</td>'; } } } } ?> Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#241540) next »