Q:

php email function does not send the records of while loop

This is my email.php page coding. My php email function code working perfectly. I'm faced a small problem here. I didn't get the database records inside the while($t_row = mysql_fetch_array($tariff_query)){}. But, it send the remaining records from database correctly. How to send the database records of inside the while($t_row = mysql_fetch_array($tariff_query)){}?
include("config.php");
    if(isset($_GET["id"]))
    {
        $id = mysql_real_escape_string($_GET["id"]);
        $query = mysql_query("SELECT * FROM ebvouchers WHERE VoucherID = $id");
        $row = mysql_fetch_object($query);
        echo mysql_error();
        $tariff_query = mysql_query("SELECT * FROM ebvouchertariffs WHERE VoucherID_Fk = $id");

    $strMessage = "<table width=1200 align=center cellpadding=0 cellspacing=0 bgcolor=#FFFFFF>
    <tr>
      <td width=1026 height=8 colspan=2>&nbsp;</td>
    </tr>
      <tr>
        <td colspan=8>
        &nbsp;
        <table class=glow width=1070 border=0 align=center cellpadding=0 cellspacing=0>
          <tr>
            <td height=40 colspan=4 style=border-radius: 5px 5px 0px 0px; class=headdetail>GUEST DETAILS </td>
            </tr>
          <tr>
            <td width=263 height=10 class=detailsfont>&nbsp;</td>
            <td width=228>&nbsp;</td>
            <td width=239 class=detailsfont>&nbsp;</td>
            <td width=340>&nbsp;</td>
          </tr>
          <tr>
            <td height=40 class=detailsfont>Voucher ID :</td>
            <td width=228 class=fetchfont>$row->VoucherID</td>
            <td width=239 class=detailsfont>Voucher Reference Number :</td>
            <td width=340 class=fetchfont>$row->VoucherReference</td>
          </tr>
         //some codes
         //some codes
         //some codes
         //some codes
         //some codes
         //some codes
         //some codes
          <tr>
            <td colspan=4>
            &nbsp;
            <table class=myborder width=1050 border=0 align=center cellpadding=10 cellspacing=0>
              <tr>
                <td width=70 height=40 class=tarifffont>Serial No</td>
                <td width=130 class=tarifffont>Date</td>
                <td width=250 class=tarifffont>Particulars</td>
                <td width=100 class=tarifffont>No of Nights</td>
                <td width=100 class=tarifffont>Rate</td>
                <td width=100 class=tarifffont>Price</td>
                <td width=100 class=tarifffont>Tax %</td>
              </tr>";
              while($t_row = mysql_fetch_array($tariff_query))
                {
                    "<tr>
                    <td class=insidetariff>". $t_row['TariffSlNo'] ."</td>
                    <td class=insidetariff>". $t_row['TariffDate'] ."</td>
                    <td class=fetchfont>". $t_row['TariffParticulars'] ."</td>
                    <td class=insidetariff>". $t_row['NoOfNights'] ."</td>
                    <td class=insidetariff>". $t_row['TariffRate'] ."</td>
                    <td class=insidetariff>". $t_row['TariffPrice'] ."</td>
                    <td class=insidetariff>". $t_row['TariffTax'] ."</td>
                    </tr>";
                }
              "<tr>
                <td height=40 colspan=2 class=detailsfont>Total Price (Overall Price) : </td>
                <td height=20 colspan=2 class=tarifffont>$tt_row->TariffAddTotal</td>
                <td height=20 class=insidetariff>Net Total (Overall Tax) : </td>
                <td height=20 colspan=2 class=tarifffont>$tt_row->TariffNetTotal</td>
                </tr>
              <tr>
                <td height=20 colspan=7 class=detailsfont>&nbsp;</td>
                </tr>
              <tr>
                <td height=40 colspan=5 class=detailsfont>Final Amount : </td>
                <td height=40 colspan=2 class=tarifffont>$tt_row->TariffFinalTotal</td>
                </tr>
            </table></td>
            </tr>
            <td colspan=4>&nbsp;</td>
        </table>
        </td>
      </tr>";
    }

A:

You must append the data to the string. So the code will be like this:
while ($t_row = mysql_fetch_array($tariff_query)) {
    $strMessage .= "<tr>
    <td class=insidetariff>". $t_row['TariffSlNo'] ."</td>
    <td class=insidetariff>". $t_row['TariffDate'] ."</td>
    <td class=fetchfont>". $t_row['TariffParticulars'] ."</td>
    <td class=insidetariff>". $t_row['NoOfNights'] ."</td>
    <td class=insidetariff>". $t_row['TariffRate'] ."</td>
    <td class=insidetariff>". $t_row['TariffPrice'] ."</td>
    <td class=insidetariff>". $t_row['TariffTax'] ."</td>
    </tr>";
}
$strMessage .= "<tr>
<td height=40 colspan=2 class=detailsfont>Total Price (Overall Price)....

Also, use of mysql_* functions is deprecated and will be removed in the future. You should use mysqli_* functions now.

