I bet this is loop 101 but here it goes. I am only getting the results printed to screen since, of course, that’s what I’m using in the code (i.e. echo) but I want to save what is printed as an actual string. I do not want it to show up but simply be passed.
This is normally a piece of cake for me but this is a nested loop which is confusing me. Currently this is the results printed to screen. “Qty: 1 – 2″ Designer Wood Blinds | Qty: 2 – 2″ Designer Wood Blinds | Qty: 3 – 2″ Designer Wood Blinds |” which is perfect format and everything. I want that as a $string that I can pass onto the shopping cart description.
What do I replace the “echo” parts of the script with? Thank you from a very loopy mind.
$desc_details = mysql_query("SELECT qty, prodid FROM cartitems WHERE uniquetoken = '".$uniquetoken."';");
while($detail_list = mysql_fetch_array($desc_details))
{
echo "Qty: " .$detail_list['qty']. " - ";
$desc_prodid = mysql_query("SELECT * FROM products WHERE prodid = '".$detail_list['prodid']."';");
while($detail_prod = mysql_fetch_array($desc_prodid))
{
echo $detail_prod['prodname']. " | ";
}
};
$str will store your data as string