duanji8615 2019-03-10 14:42
浏览 87

获取相同字段名称的多个记录

I have an event booking Wordpress website in which people, after booking receive an email regarding their booking details. That details get stored in an MYSQL Row. But if that person has more than one booking or has multiple records of different seats. Then whenever he tries to get a confirmation email for his second booking, only the first record is being fetched from the database, not the second one. Is there a way to get two emails at the same time for two bookings.

Here is my code:

<?php
    date_default_timezone_set('Asia/Dhaka');

    /*---------------DB connectivity start--------------------------------*/
    $host="host";
    $user="user";
$password="password";
$db="db";

mysql_connect($host,$user,$password);
mysql_select_db($db);

if(isset($_POST['email'])){

    $email1=$_POST['email'];
    //echo "Email id ";
   // echo $email1;
    $query="select * from wp_bap_orders where email='".$email1."' ";

    $result=mysql_query($query);

    $count=mysql_num_rows($result);    
    if($result->num_rows > 0)
    {
         while ($rows=mysqli_fetch_row($result)){
    $rows=mysql_fetch_array($result);
    $orderid = $rows['order_id'];
    $name1  =  $rows['first_name'];
    $name2  =  $rows['last_name'];
    $name3 = $name1 . " " . $name2;
    $email2  =  $rows['email'];
    $phone  =  $rows['phone'];
    $date  =  $rows['date'];
    $code  =  $rows['code'];
    $places  =  $rows['places'];
    //collect seat numbers
    $seatnumbersstr = '';
        foreach(unserialize($rows['places']) as $placearr){
            $seatnumbersstr=$seatnumbersstr.','.$placearr['place_name'];
        }
    $price  =  $rows['total_price'];
    $scheme_id  =  $rows['scheme_id'];
    $event_id  =  $rows['event_id'];
    $event  =  $rows['event'];
    $payment_type  =  $rows['payment_type'];
    //echo $scheme_id ;
    $qry1="select * from wp_bap_schemes where scheme_id='$scheme_id '";
         $result1=mysql_query($qry1);
            $count1=mysql_num_rows($result1); 
            if($count1==1)
                {
                $rows1=mysql_fetch_array($result1);
                $eventname =  $rows1['name'];//FETCHING EVENT NAME
                $eventdesc =  $rows1['description'];//FETCHING EVENT NAME
                }

    //echo $eventname;
    //echo " was found";



$message        = "
<html>
<body>
<center>
  <p align='center'>
  <font face='Verdana'><u><b><font size='4' color='#800000'>
  Booking confirmation mail</font></b></u></font>
  </p>

 <table border='0' cellspacing='1' width='92%' id='AutoNumber10' class='simpletext'>
 <tr>
    <td align='right'> <strong> Name :</strong></td>
    <td >&nbsp;</td>
    <td >". $name3."</td>
  </tr>
  <tr>
    <td align='right'> <strong>Email :</strong></td>
    <td >&nbsp;</td>
    <td >". $email2 ."</td>
  </tr>
  <tr>
    <td align='right'> <strong>Phone No :</strong></td>
    <td >&nbsp;</td>
    <td >". $phone ."</td>
  </tr>
   <tr>
    <td align='right'> <strong>Seat Number :</strong></td>
    <td >&nbsp;</td>
    <td >". $seatnumbersstr ."</td>
  </tr>
     <tr>
    <td align='right'> <strong>Event Booked :</strong></td>
    <td >&nbsp;</td>
    <td >". $eventname ."</td>
             <tr>
    <td align='right'> <strong>Show :</strong></td>
    <td >&nbsp;</td>
    <td >". $eventdesc."</td>
  </tr>
  </tr>
       <tr>
    <td align='right'> <strong>Amount :</strong></td>
    <td >&nbsp;</td>
    <td >". $price."</td>
  </tr>
   <tr>
    <td align='right'> <strong>Transitional ID :</strong></td>
    <td >&nbsp;</td>
    <td >". $code."</td>
  </tr>
</table>   
<h3 align='left'>Dear ". $name3 . ",</h3>
<p align='left'>Thank you for your booking with nokta.</p>          
</body>
</html>";
         }   
//$to="$email1";
    $to="admin@onesolution.co.in";
$subject = "Booking Confirmation email";
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-Type: text/html; charset=ISO-8859-1
";
$headers .= "From: info@noktaarts.com" . "
" .
"CC: admin@onesolution.click";
mail($to,$subject,$message,$headers);
        echo '<script> alert("We Have Send Your Booking Ticket To Your Email Address. Please Ckeck Your Email."); window.location="index.php"; </script>';
     // print "<script>alert('We Have Send Your Booking Ticket To Your Email Address.</br>Please Ckeck Your Email.'); </script>";
//echo "You Have Received Your Booked Ticket Vai Email.</br> Please Check Your Email."; 

}



else
{
    echo"Not found";
}
}
?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)