[thelist] looping through output with PHP

Joe Crawford jcrawford at avencom.com
Tue Jun 5 17:13:03 CDT 2001


John Corry wrote:
> I've done simple database retrieval and display with PHP.
> Now I want to get a little 'tricky'...but I'm having a hard time conceiving
> the code that'll make it work...
> Looping with while is easy...I just output each row from the DB into a row
> in the HTML table output. cake.
> So, how do I put <gasp> 2 rows of DB returns on one row of HTML output?

What do you want the final html to look like? - that'll dictate how you
html-i-fy the output that comes out of the database. It's hard to see
what you mean, other than perhaps you could save the output to a
variable thus:

$result=mysql_query( $query ) or die ("Cannot make query.");
$tempvar = "";
while ($row = mysql_fetch_array ($result))
        {
        $tempvar .= $row['WHATEVER'];
        };
echo $tempvar;

What are you trying to do?

  - Joe <playing with
         http://members.evolt.org/artlung/
         More to come from that!
         Thanks evolt (and esp. Mr. djc!!>
--
Joe Crawford ||||||||||||||       mailto:jcrawford at avencom.com
||||||||||||||||||||||||             http://www.avencom.com
|||||||||||||||||||||||||||      Avencom: Set Your Sites Higher




More information about the thelist mailing list