[thelist] reworded MySQL query insert and back again

Andrew Maynes andrew at humanbehaviour.co.uk
Wed Feb 12 07:24:00 CST 2003


Mich that was a typo sorry about that... it should be:

ColorName  ColorID

The output looks just like a drop down box with all the colours listed :)

which is from this function / query:

function showColor($item_id)
{
 $query="select ref_colours.* from item_color ,ref_colours where
ref_colours.ColorID=item_color.color_id and item_color.item_id=$item_id";
$rs=mysql_query($query);
	if(!$rs)
	{
	echo "Error while exeuting the query";
	}
	else
	{
	while($row=mysql_fetch_array($rs))
		{
		$color_id=$row['ColorID'];
		$cName=$row['ColorName'];
		echo "<option value=\"$color_id\">$cName</option>";
		}
	}
}

I think what Rudy is trying to suggest is create another query to input the
actual colour name into the table instead of the colourID but I thought I had
already done this and that all I need to do was input colorName

Clearly there is another query needed but this has thrown me.... actually it's
starting to make sense the more my head throbs :)  I'll just pop another couple
of codine

Andrew




More information about the thelist mailing list