[thelist] laying out in PHP

Andrew Forsberg andrew at thepander.co.nz
Wed Feb 27 15:24:00 CST 2002


>this is the code I am using at the point I am having trouble with. $type is
>passed to the browser when on the catalogue page you click either wheels or
>misc.

Three things:
1) Don't SELECT * anything... :)
2) Do put the <table> and </table> completely outside the $row processing loop.
3) Get rid of the do while loop, and change the if ($row= ...) to a
while ($row=....)

If you want to test first to see if any rows have been retrieved, so
you can short circuit tables altogether, add

if (mysql_num_rows($result) > 0) {

before the while ($row = ...)

But I'm still having trouble understanding what problem you have with
the code -- aside from the last missing } and the do...while stuff
(which always looks wrong to me). The rest is more or less a question
of style -- it will do what you've shown us, what do you want it to
do?

Cheers
Andrew

--



More information about the thelist mailing list