I'm running a PHP query which returns several rows / columns. (Im returning the columns: name, quantity, unit, producer, notes) * X rows (depending on how many rows were found in the database).
$sql = "SELECT products.name, products.unit, lists.quantity, lists.producer, lists.notes FROM lists,products WHERE lists.familyid ='$familyid' AND lists.productid = products.id ";
$sqlmessage=mysql_query($sql);
Now i would like to arrange this response into a STRING, in order to email it using mail($to,$subject,$message,$headers)
.
Im trying to use the following function, however im not getting the correct list but rather alot of " fetchColumn(name) "
The Broken function:
for ($i=0; $i<mysql_num_rows($sqlmessage); ++$i){
while ($row = mysql_fetch_array($sqlmessage)){
$name = $row->fetchColumn($i);
$message .= "$name";
$message .= ", ";
}
}
What do i need to change to get the correct information out ? Been searching for a day now and trying different things without any success.'