Re: table loop problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Agence Sezam-interactive -- [Pierre] wrote:
> 
> Just use in Yours loops after querying with mysql_query . U just have to 
> do a loop with a
> 
> [...] <tr>
> <?
> while($db_line=mysql_fetch_array($resukt_of_db)) {   ?>
> 
> <td> starts here <? echo "ur blabla".  $db_line[image_ur]; ?> </td>
> <?
> }   ///looop ends here
> ?>
> </tr>
> 
> 


Take a look at ADODB. It doesn't achieve perfect PHP/HTML separation, 
but I find it much easier to use in templates. The template simply has 
the table opening and a directory row, then code for the list string, 
which is scrunched up code consisting of rows generated from the 
database. Makes it extremely easy to code tables, since they only need a 
skeleton:


EXAMPLE

<table>
<tr><td>Title Row</td><td>Title Row</td></tr>
{LIST}
</table>

Then set the page template LIST to the string generated by a class 
function which generated something like:

function doSomething(){
$LIST='';
while (!$RESULT->EOF) {
	$LIST .= "<TR valign=\"top\">
	<TD>Comment By: {$RESULT->fields['username']} </TD>
	<TD>$RESULT->fields['comment']</TD>
	</TR>";		
$RESULT->MoveNext();
  }
RETURN $LIST;
}

Makes it easier to add things like alternating row colors, etc. than the 
example given previously, but it's horses for courses!
-- 
-------LDS--------LDS--------LDS-------

Tech@xxxxxxxxxxxxxxxxxxxxxxxxxx
Litigation Data Services, PLC

-------LDS--------LDS--------LDS-------



PHP Data object relational mapping generator - http://www.meta-language.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux