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'] . '...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.