I'm attempting to select all of the ids in one table and then use the result of that query in another query. The first query works successfully, but the second query returns only the name for the first id of the initial query. Ack- easier to see the code and let me know what I'm doing wrong/missing:
$typeidquery = "SELECT typeid FROM type WHERE subtype = 'Soda Pop & Water'";
$typeidresult = mysql_query($typeidquery);
$typeids = "";
while (list($id) = mysql_fetch_row($typeidresult)){
$typeids .= "$id ";
}
$sodaquery = mysql_query("SELECT prodname FROM product WHERE typeid = '$typeids'");
list($sodaname) = mysql_fetch_row($sodaquery);
print "<p>$sodaname";
$sodaname should return all soda names related to $typeids. $typeids is returning the correct result.
I'm just a learnin'. Thanks much in advance.
$typeidquery = "SELECT typeid FROM type WHERE subtype = 'Soda Pop & Water'";
$typeidresult = mysql_query($typeidquery);
$typeids = "";
while (list($id) = mysql_fetch_row($typeidresult)){
$typeids .= "$id ";
}
$sodaquery = mysql_query("SELECT prodname FROM product WHERE typeid = '$typeids'");
list($sodaname) = mysql_fetch_row($sodaquery);
print "<p>$sodaname";
$sodaname should return all soda names related to $typeids. $typeids is returning the correct result.
I'm just a learnin'. Thanks much in advance.