应该发生什么:表格不搜索数据库或在页面上显示
用户键入他们的ID到框中,然后单击检查。 它搜索名为“潮湿”的数据库。 搜索查找名为“卡”的表中并在名为“state_id”的特定字段中查找。
如果STATE_ID的值是1的形式将回显通,如果是二回声取消,如果它的3它回声过期,如果它不能找到它,它回声未找到。
实际发生的情况是表单没有正确搜索,也没有显示任何内容。我试图将其更改为开关(下)而不是如果现在表单不显示。
<? include('common.php') ?>
<?php
if(isset($_POST['check']))
{
$conn = mysql_connect($server, $db_user, $db_pass);
if(! $conn)
{
die('Could not connect: ' . mysql_error());
}
$id = $_POST['id'];
$sql ="SELECT state_id FROM card WHERE id = '$id'" ;
mysql_select_db('damp');
$result = mysql_query($sql, $conn);
switch ($result)
{
case "1":
echo "pass";
break;
case "2":
echo "canceled";
break;
case "3":
echo "expired";
break;
default:
echo "not found";
}
//echo $_GET['here']; // Prints the name of the page content
//echo $class_obj_id; // Prints the id number of the selected row
?>
<form method="post" action="<?php $_PHP_SELF ?>">
<h2>Check Auth</h2>
<table width="250" border="0" cellspacing="1" cellpadding="2">
<tr>
<td width="50" align="center">ID</td>
<td><input name="id" type="text" id="id" value="<?php echo($class_obj_id); ?>" /></td>
</tr>
<tr>
<td width="100"> </td>
<td> </td>
</tr>
<tr>
<td width="100"> </td>
<td>
<input name="check" type="submit" id="check" value="Check">
</td>
</tr>
</table>
</form>
<?php
}
?>
对不起更改过的文字。没有错误信息,只是剂量工作 – Lazis002
这个问题似乎是离题,因为'E_DOEST_WORK'不是一个已知的PHP错误代码。 –