[thelist] Another MySQL Query with PHP

Andrew Maynes andrew at humanbehaviour.co.uk
Mon Feb 10 10:35:54 CST 2003

I have a table that holds al the records for items.  Each item has a colour and
a size and could have more than one colour and size.  So tables have been
created to keep records for each items colour and size.  ref_colours ref_size
hold the names and item_colour item_size hold item - colour item -size

When an item is displayed its respective colours and sizes are pulled using this

function showSize($item_id)
 $query="select ref_size.* from item_size ,ref_size where
ref_size.size_id=item_size.size_id and item_size.item_id=$item_id";
	echo "Error while exeuting the query";
		echo "<option value=\"$size_id\">$size</option>";

when this item is selected by the visitor the item is held in a temporary table.
The colour and size are held in this table as size and colour.

When I pull the record back I am not geetting the colour or size name but
instead the value of the colour and size.  I guess I need to create a query to
convert the value back to the name but my head is starting to spin unnecessarily
perhaps!  Can someone just shed a little light on my query please?


Tel: +44 (0) 777 55 212 95

Information in this email is confidential and may be privileged.
It is intended for the addressee only. If you have received it in error,
please notify the sender immediately and delete it from your system.
You should not otherwise copy it, retransmit it or use or disclose its
contents to anyone.
Thank you for your co-operation.

More information about the thelist mailing list