我正在运行设置一个名为 PHP 变量的代码,$update_email
然后从 2 个不同的表中选择以将数据添加到该变量中。
这是我所拥有的:
$update_email='<font face="Calibri">';
$update_email.='<font color="#999999">## - Please type your reply above this line - ##</font>
<br><br>
Your Support Ticket (#'.$_POST["ticketnumber"].') has been updated. You can reply to this email or click the link below to respond.
<br><br>
<a href="http://www.domain.co.uk/customer/tickets/viewticket.php?seq='.$_POST["ticketnumber"].'">http://www.domain.co.uk/customer/tickets/viewticket.php?seq='.$_POST["ticketnumber"].'</a>
<hr />
<br>';
$update_email.='<strong>'.$_SESSION["domain.co.uk"]["forename"].' '.$_SESSION["domain.co.uk"]["surname"].' | Technical Support</strong>
<br>
'.date("d F Y G:H").'
<br><br>
'.nl2br($_POST["ticket_update"]).'
<br><br>
<hr />';
//select all the updates from the ticket_updates table
$sql="SELECT * from ticket_updates where ticket_seq = '".$_POST["ticketnumber"]."' order by datetime ASC";
$sql=mysql_query($sql,$conn);
while($result=mysql_fetch_array($rs))
{
//check if its a customer update or Integra update
if($result["customer"] == 'Yes')
{
//get the company(customer) information
$sql2="SELECT * from tickets where ticketnumber = '".$result["ticket_seq"]."' ";
$rs2=mysql_query($sql2,$conn);
$ticket2=mysql_fetch_array($rs2);
//now select the customer information
$sql3="SELECT * from customer where sequence = '".$ticket2["company"]."' ";
$rs3=mysql_query($sql3,$conn);
$customer2=mysql_fetch_array($rs2);
$name_text = $customer["company"];
}
else
{
$name_text = 'Technical Support';
}
//set the right date/time format
$update_time = strtotime($result["datetime"]);
$update_time = date('d F Y G:H', $update_time);
$update_email.='<strong>'.$result["updatedby"].' | '.$name_text.'</strong>
<br>
'.$update_time.'
<br><br>
'.nl2br($result["notes"]).'
<br><br>
<hr />';
}
//now add the initial problem
//check if its a customer opened ticket or staff
if($ticket["email_to_ticket"] == 'Yes')
{
//get the company(customer) information
$sql2="SELECT * from tickets where ticketnumber = '".$ticket["ticket_seq"]."' ";
$rs2=mysql_query($sql2,$conn);
$ticket2=mysql_fetch_array($rs2);
//now select the customer information
$sql3="SELECT * from customer where sequence = '".$ticket2["company"]."' ";
$rs3=mysql_query($sql3,$conn);
$customer2=mysql_fetch_array($rs2);
$name_text = $customer["company"];
}
else
{
$name_text = 'Technical Support';
}
//set the right date/time format
$ticket_open_time = strtotime($ticket["datetime"]);
$ticket_open_time = date('d F Y G:H', $ticket_open_time);
$update_email.='<strong>'.$ticket["opened_by"].' | '.$name_text.'</strong>
<br>
'.$ticket_open_time.'
<br><br>
'.nl2br($ticket["summary"]).'
<br><br>
<hr />';
$update_email.='</font>';
代码没有问题,没有错误等,但是当我回显 $email_update; 它只显示表中的行和tickets
表中的一行,ticket_updates
但如果我直接在数据库中运行 SQL,则应该从ticket_updates
表中显示更多行
.=
在 while 循环中使用 on 变量有问题吗?我应该以另一种方式这样做吗?