How can I use results from one query in a second query?
Posted: Mon Mar 12, 2012 8:51 am
I am retrieving results from a query and trying to insert them into a second query..
that code does this
213, 321, 123, 221, 321,
which is great but how do insert that into the next query? I am currently doing this.
the problem is it gives me this result.
which does not work.. I need to end the query with a 321) not a 321, )
any help on how to alter this
to get the last value to do 321) not a 321, )???
Code: Select all
$sqlstring3 = "SELECT ///// ";
$result2 = mysql_query($sqlstring3);
while ($row = mysql_fetch_array($result2, MYSQL_ASSOC))
{
$strquery .= " ".$row["numbers"].", ";
}
mysql_free_result($result2);
213, 321, 123, 221, 321,
which is great but how do insert that into the next query? I am currently doing this.
Code: Select all
$query = "select * from ??? where number IN (".$strquery.") order by Value";
Code: Select all
$query = "select * from ??? where number IN (213, 321, 123, 221, 321, ) order by Value";
any help on how to alter this
Code: Select all
while ($row = mysql_fetch_array($result2, MYSQL_ASSOC))
{
$strquery .= " ".$row["numbers"].", ";
}
to get the last value to do 321) not a 321, )???