我的html表单 - >
<form action="where.php" method="post">
<h2 align="center" style="color: white;"> Search Challan </h2>
<table border="1" bgcolor="grey" align="center">
<tr>
<td align="center"> Search a Challan Details . Enter the Challan no below :</td>
</tr>
<tr>
<td align="center">
</tr>
<tr>
<td align="center"><input type="submit" name="submit" value="Search"align="middle" ></td>
<tr>
<td>
<select name="squery" style="width:142px;" >
<option value="challan_no">Challan no </option>
<option value="product_name">Product Name</option>
<option value="Buyer">buyer</option>
<option value="Employee Responsible">Employee</option>
</td>
</tr>
<tr>
<td>
<input type="text" name="search" >
</td>
</tr>
</tr>
</form>
where.php - &gt;
<?php
$dbhost='localhost';
$dbusername='root';
$dbuserpass='';
$dbname='inventory';
//connect to the mysql database server.
$con = mysql_connect ($dbhost, $dbusername, $dbuserpass);
if (!$con ) die ("unable to connect : ". mysql_error());
mysql_selectdb("$dbname",$con ) ;
$user_req = $_REQUEST['squery'] ; //colomn name
$req_id = $_REQUEST['search'] ; //
$query = "SELECT * FROM challan WHERE '$user_req' = $req_id ";
$result = mysql_query($query);
if (!$result) die ("DAtabase acces faild bc : ". mysql_error());
$rows = mysql_numrows($result);
for ($j=0 ; $j < $rows ; ++$j)
{
$row = mysql_fetch_row($result);
echo "<TABLE border=1 bgcolor=grey align=center width=500px float=left>" ;
echo "<tr>";
echo "<td align=center>Challan no : </td>";
echo " <td> $row[0] </td>";
echo " </tr>";
echo "<tr>";
echo "<td align=center>Challan Date : </td>";
echo " <td> $row[1] </td>";
echo "<tr>";
echo "<td align=center>Product Name : </td> ";
echo " <td> $row[2] </td>";
echo "<tr>";
echo "<td align=center>Product qty : </td> " ;
echo " <td> $row[3] </td>";
echo "<tr>";
echo "<td align=center> Buyer : </td> " ;
echo " <td> $row[4] </td>";
echo "<tr>";
echo "<td align=center>Employee Responsible : </td> " ;
echo " <td> $row[5] </td>";
echo "</tr>";
}
?>
它的输出只是空白。我无法确定我哪里出错了。
答案 0 :(得分:1)
空白屏幕表示发生了致命错误且php无法继续执行脚本,您可以在脚本顶部运行此错误,应将错误打印到屏幕上作为输出的一部分。
<?php
ini_set('display_errors', 1);