Php 代码运行时没有任何错误…除非它不会显示
我使用的代码没有给我任何MySQL错误,这很好 除了它不会显示我在url栏中搜索的结果外,它看起来像是这样的搜索。php?出发?标签=达累斯萨拉姆&到达?标签=桑给巴尔&txtDate1=03%2F19%2F2012&txtDate2=03%2F20%2F2012&ddlPAxADT=1&ddlpaxhd=0&ddlPaxINF=0&search=Submit这是我想要的,因为这意味着所有信息都被传递了 它只显示一个白色屏幕 这是密码Php 代码运行时没有任何错误…除非它不会显示,php,mysql,Php,Mysql,我使用的代码没有给我任何MySQL错误,这很好 除了它不会显示我在url栏中搜索的结果外,它看起来像是这样的搜索。php?出发?标签=达累斯萨拉姆&到达?标签=桑给巴尔&txtDate1=03%2F19%2F2012&txtDate2=03%2F20%2F2012&ddlPAxADT=1&ddlpaxhd=0&ddlPaxINF=0&search=Submit这是我想要的,因为这意味着所有信息都被传递了 它只显示一个白色屏幕 这是密码 <?PHP $button = $_GET['s
<?PHP
$button = $_GET['submit'];
$search = $_GET['search'];
$sfrom = $_GET['departure_label'];
$sfromda = $_GET['txtdate1'];
$sto = $_GET['arrival_label'];
$stoda = $_GET['txtdate2'];
$padt = $_GET['ddlPaxADT'];
$pchd = $_GET['ddlPaxCHD'];
$pinf = $_GET['ddlPaxINF'];
include "connection.php";
$result=mysql_query("SELECT * from search_v where rout_from like'".$sfrom."' and rout_to like'".$sto."' and DATE_FORMAT(date_avialable,'%Y-%m-%d') between'".$sfromda."' and '".$stoda."' LIMIT 10") or die(mysql_error());
while($runrows = mysql_fetch_assoc($result)){
$flightid = $runrows['flight_id'];
$aseats = $runrows['seats_avialable'];
$todate = strftime("%b %d, %Y %l:%M %p" ,strtotime($runrows['to_date']));
$date = strftime("%b %d, %Y %l:%M %p" ,strtotime($runrows['date_avialable']));
$from = $runrows['rout_from'];
$to = $runrows['rout_to'];
$acost = $runrows['adult_cost'];
$ccost = $runrows['child_cost'];
$cur = $runrows['currency'];
$oth = $runrows['other_cost'];
echo "";
?>
<li class="item clearfix"> <span
id="cntntMiddle_ctl01_rptmain_lblFromt_0">
<table cellpadding="0" cellspacing="0">
<thead><tr>
<th class="price">Price</th>
<th>From</th>
<th>To</th>
<th>Depart</th>
<th>Arrive</th>
</tr>
</thead><tfoot> <tr>
<td><a class="more" href="#">Full
Details</a></td>
<td colspan="6">
<div class="select-wrap">
<p class="seats"><strong><?php echo $aseats; ?></strong> <span>seats
left</span> <em>at this price</em></p>
<button class="btn-select" type="button"
onclick='return ray.ajax("#");'>Select Flight</button></div>
</td>
</tr>
</tfoot><tbody>
<tr>
<td class="price" rowspan="2"><a
style="font-weight: bold; cursor: pointer; text-decoration: none;"
herf="#" onclick='return ray.ajax("#");'><span
style="font-size: 24px; font-weight: bold;"><?php echo $totalcost; ?></span><span
style="font-size: 11px; margin-top: 2px; display: block; color: rgb(255, 255, 255); text-align: center; font-weight: normal;">per
adult</span><span
style="font-size: 12px; margin-top: 2px; display: block; color: rgb(255, 255, 255); text-align: center; font-weight: normal;">(with fees)</span></a></td>
<td><?php echo $from; ?></td>
<td><?php echo $to ?></td>
<td style="padding-right: 2px;">4:05 PM</td>
<td>7:05 PM</td>
</tr>
</tbody>
</table>
</span> <a
id="cntntMiddle_ctl01_rptmain_lblResultDetails1_0" title="1"
href="javascript:__doPostBack('ctl00$cntntMiddle$ctl01$rptmain$ctl00$lblResultDetails1','')"
style="color: Black;"></a><a class="close"
href="#">Close</a>
<div class="info clearfix">
<div class="info clearfix">
<h4>Departing Flight</h4>
<ul class="clearfix">
<li>
<h5><?php echo $from; ?> to <?php echo $to; ?> <?php echo $date; ?></h5>
<ul>
<li> </li>
<li><strong>Flight #</strong> - <?php echo $flightid; ?></li>
<li><strong>Departure Time – </strong>
6:05 PM</li>
<li><strong>Arrival Time</strong> - 5:05 PM</li>
</ul>
</li>
</ul>
<ul>
<li style="padding-top: 5px;"><span
style="color: rgb(212, 22, 13); font-weight: bold; font-size: 11px; text-decoration: none;">
Fare Breakdown</span> </li>
</ul>
<table class="more">
<tbody>
<tr>
<th>Passenger</th>
<th>Fare</th>
<th> Taxes and Fees</th>
<th>Qty</th>
<th>Total Cost</th>
</tr>
</tbody><tbody>
<tr>
<td>Adult</td>
<td
style="color: rgb(100, 100, 100); font-size: 11px; font-weight: bold;"><?php echo $acost; ?></td>
<td><?php echo $oth; ?></td>
<td id="paxAdtTd">1</td>
<td><?php echo $totaladult; ?></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>Cost of Sale(<?php echo $cur; ?>)</td>
<td> </td>
<td
style="color: rgb(100, 100, 100); font-size: 14px; font-weight: bold;"><?php echo $totaladult; ?></td>
</tr>
</tbody>
</table>
<br />
<span style="font-weight: bold; padding-top: 10px;">
*Additional airline fees for baggage may apply</span>
<div class="select-wrap">
<p class="seats"><strong><?php echo $aseats; ?></strong> <span>seats
left</span> <em>at this price</em></p>
<button class="btn-select" type="button"
onclick='return ray.ajax("https://res.website.com/checkout.aspx?recommendation=1&subset=1&supplier=53&page=flightconfirm",1,this);'>Select
Flight</button></div>
<?php
}
?>
有两种逻辑?错误,使用LIKE函数时,您没有使用通配符%键,并且在接下来的LIKE情况下,对于$sto,您没有提供空格。打开错误显示和最大错误报告级别。是否打开了错误报告?是的,它们都打开了。只是为了检查一下,我从echo中删除了一个引号,看看mysql是否能捕捉到它。你确定,你的查询结果集不是空的吗?有数据,只是没有显示出来。如果我没有使用like函数,而是使用了“=”函数,查询是否仍然有效?这取决于你想搜索的方式。我建议使用regexp而不是LIKE@MohamedYusuf尝试使用print\r$runrows;在你的while循环中。请告知输出情况!你的第一篇文章实际上很有建设性。它给了一个错误,而不是一个空白页lol它说,这是你的SQL语法错误;查看与您的MySQL服务器版本相对应的手册,了解在“达累斯萨拉姆”附近使用的正确语法,以及类似“桑给巴尔”和“日期”的rout_FORMATdate_Aviable,第1I行的“%Y-%”建议您将变量用作{$sto},而不是使用串联。这很有帮助!
$result=mysql_query("SELECT * from search_v where rout_from like %'".$sfrom."'% and rout_to like %'".$sto."'% and DATE_FORMAT(date_avialable,'%Y-%m-%d') between'".$sfromda."' and '".$stoda."' LIMIT 10") or die(mysql_error());