Jump to content

Storing results from a while loop into a variable?


wright67uk

Recommended Posts

I'm collecting tips on a website, and Im trying to make a 'send as email' feature, where all of the tips from today's date can be sent to users.

 

As Im already displaying todays tips on my website, I would like to put the tips into a variable, ready for mailing.  How do I do this?

 

Do I just put $message =  (before the while loop?)



$query = "SELECT placed, win, id, date, horse, course, odds1, odds2, sp, place, time, tip, description, booky, date_added, time_added FROM toptips WHERE userid = 54 AND `date` ='".$curentDate."'  order by date desc"; 
$result = $mysqli->query($query);

while($row = $result->fetch_array()) 
{ $rows[] = $row; 
}
if(count($rows)>0){
foreach($rows as $row) 
{ 
$date = $row['date'];
$date = date("d/m/y", strtotime($date));
$id = $row['id'];
$booky = $row['booky'];
$sp = $row['sp'];
$placed = $row['placed'];
// if ($sp === 'yes') {$start = ' SP';}

echo  
       '<div style= "width:700px; font-family:verdana;">
	<div style="float:left; width:700px; margin-bottom:10px; margin-top: 10px; padding:10px; 
         border: solid 1px grey;">
         
        <h5>
	('.$date.") " .
      	 $row['time'] . " " . 
      	 $row['course'] . " - " . 
       	 $row['horse'] . " " . 
      	 $row['odds1'] . "/" . $row['odds2'] . $row['sp'] . "-" . $row['place'] .
       '</h4><img src="' . $row['tip'] . '.png" alt=" '. $row['tip'] .' " height="42" width="42" 
         style="float:right"><br>'. 
         $row['description'] . '...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.