hi I need help with 2 mysql queries I am working on. I need to get data from first query and use it in second query.
First query (get different extension for domains)
$resultExt = mysql_query("SELECT * FROM extension”) or die(mysql_error());
while($rowExt = mysql_fetch_array( $resultExt )) {
$extDom = $rowExt[‘ext’];
$postDom = 'Domain_’ . $extDom ;
$dom_to_show .= '$rowCart[$postDom];';
}
and I get my list of domain extensions
$Domain_com = $rowCart[‘Domain_com’]; $Domain_net = $rowCart[‘Domain_net’];
and so on
Second Query (get data from cart) then I need to get data from cart table
$showCart = mysql_query("SELECT * FROM cartlist where Session = '".$session."' ORDER BY ID DESC") or die(mysql_error());
while($rowCart = mysql_fetch_array( $showCart )) {
//here i need to get variable like $Domain_com = $rowCart['Domain_com’];
//if I use echo $dom_to_show; or $dom_to_show; I get no result
}
what do I need to put inside the second while to get results from query?
thanks
The echo should echo out a result, i have added an array that will get all the data in the row and output it after it has ran. This will help you see if there is any data returned from the query.
$showCart = mysql_query("SELECT * FROM cartlist where Session = '".$session."' ORDER BY ID DESC") or die(mysql_error());
while($rowCart = mysql_fetch_array( $showCart )) {
//here i need to get variable like $Domain_com = $rowCart['Domain_com’];
//if I use echo $dom_to_show; or $dom_to_show; I get no result
echo $rowCart['Domain_com'];
//or
$array[] = $rowCart;
}
echo "<pre>";
print_r($array);
also
$rowCart['Domain_com'];
was set to
$rowCart['Domain_com’];
which is wrong.