1

我真的很困惑,我的一个脚本在 wamp 中完美运行,但是当我尝试在我的 ubuntu apache2 服务器中运行它时,我得到一个空白页作为输出,当我将它上传到网络服务器并执行脚本时也会发生同样的事情。我可以确定错误是由于这行代码的存在引起的

while ($row = mysql_fetch_assoc($result))

即使我将其注释掉,问题仍然存在,只有删除此行才能让我获得任何类型的输出。如果这条线存在,即使是简单的也echo行不通。

我正在发布整个脚本,下面可能是你们可以帮助我理解这种奇怪行为背后的原因。

<?php 

session_start(); // start up the PHP session! 

//Connect to mysql

include 'conn.php';

// Table name
$tbl_name = "tailor.employee"; 

//Get and initialize variables
$op = $_POST['op'];
$cusid = $_POST['cusid'];

if($op=="2")
{
$sql = "SELECT * FROM tailor.order WHERE cusid ='$cusid'";
$result = mysql_query($sql);
// Mysql_num_row is counting table row
$count = mysql_num_rows($result);
 if($count!=0)
    {
        $order = array();
        $oid = array();
        $day = array();
        $month = array();
        $year = array();
        $quan = array();
        $i=0;

      while ($row = mysql_fetch_assoc($result)) {
                $cusid = $row['cusid'];
                $cname = $row['cname'];
                $phone = $row['phone'];
                $order[$i] = $row['type'];
                $oid[$i] = $row['oid'];
                $day[$i] = $row['day'];
                $month[$i] = $row['month'];
                $year[$i] = $row['year'];
                $quan[$i] = $row['quan'];
                $i=$i+1;
                }
                echo "<br><br><br><br><br><br>";
                echo "<pre><p><strong>Customer ID   : </strong>".$cusid."</pre></p>";
                echo "<pre><p><strong>Customer Name : </strong>".$cname."</pre></p>";
                echo "<pre><p><strong>Phone Number  : </strong>".$phone."</pre></p>";
                echo '<table border="1">';
                echo "<tr>";
                echo "<td>Quantity</td>";
                echo "<td>Order ID</td>";
                echo "<td>Particulars</td>";
                echo "<td>Delivery Date</td>";
                echo "</tr>";
                echo "<tr><td>";
                $icount = count($oid);
                for($k=0;$k<$icount;$k++)
                {

                    echo $quan[$k];
                    echo "<br>";
                }

                echo "</td>";
                echo "<td>";
                for($k=0;$k<$icount;$k++)
                {

                    echo $oid[$k];
                    echo "<br>";
                }
                echo "</td>";
                echo "<td>";
                for($j=0;$j<$icount;$j++)
                {

                    echo $order[$j];
                    echo "<br>";
                }
                echo "</td>";
                echo "<td>";
                for($l=0;$l<$icount;$l++)
                {

                    echo $day[$l]."/".$month[$l]."/".$year[$l];
                    echo "<br>";
                }
                echo "</td>";
                echo "</tr>";
                echo "</table>";
                echo '<br><br><p ALIGN = "center"><a href ="order1.html">Place New Order</a></p>';
      }

unset($_SESSION['cusid']);  
unset($_SESSION['oid']);
unset($_SESSION['type']);
unset($_SESSION['cname']);
unset($_SESSION['phone']);
unset($_SESSION['address']);
}
if($op=="1")
{
    header('location:order1.html');
}


?>

该应用程序是实时的,可以通过访问http://www.techb.wilips.com/login.html访问 登录用户名是modern密码是modern@123 要查看错误页面,只需登录,添加订单和按照步骤操作,然后在第三步,您有Operation 下拉菜单,选择Print Order

4

0 回答 0