[thelist] SQL query and filtering output with PHP

John Corry webshot at neoncowboy.com
Mon Jun 4 18:45:41 CDT 2001

I have a very simple script I'm trying to write...and I'm a little rusty
with this stuff, too much graphic design lately.

Anyway, I have a simple, one-table database of paintings. There are 20 rows
in my DB. I can retrieve all of the works and print image tags. I am
*trying* to filter different pieces into different columns in my html table
based on the contents of one of the fields, 'category'. I'm trying this
using nested while loops:
				$category = 'oil';
				while ($thumb_row = mysql_fetch_array($art_sql_result)){
					$piece = $thumb_row["path"];
					$thumbnail_path = "images/thumbnails/$piece";
					$alt = $thumb_row["title"];
					$img_tag = "<img src=\"$thumbnail_path\" height=\"60\" width=\"60\"
						while ($thumb_row["category"]=="$category"){echo ("$img_tag");
note: my DB connection works, I can write *all* of the image tags...but in
thsi case, I'm trying to write image tags only for the rows where the
category is "oil". To by bewilderment, it isn't working...any thoughts on

The logic makes sense to me...I don't get it.


More information about the thelist mailing list