retrieve data from mysql and email it

后端 未结 1 1108
广开言路
广开言路 2021-01-07 15:40

I have a php page which displays class schedule data for each user from mysql database like this:

$result = mysql_query($sql);

echo \"
1条回答
  •  时光说笑
    2021-01-07 16:17

    depending on the source of your mysql data and how it is stored can't you retrieve it and just add it to the $message variable?

    
    

    format it as you with (HTML or not, etc) .. and mail away.

    for multiple rows change the while up a little..

    
                
' $query = "SELECT * FROM yourtable WHERE youridentifier = 'unique'" $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $message .= " "; $message .= " "; $message .= " "; $message .= " "; $message .= " "; $message .= " "; } // then update the message with the ending $message .= "
Description Cost Weight Color
".$row['itemdescription']."".$row['cost']."".$row['shippingweight']."".$row['color']."
Thank you, code guy" // Then you can still use $message as your variable } ?>

That pressumption is if you are using HTML formatted emails, otherwise it'll just be formatted text.

0 讨论(0)
提交回复
热议问题