我在php中相对较新,当我从表的database...the名为'leave‘的表中检索数据时,我遇到了一个问题。更重要的是,我可以从同一个数据库的另一个表中轻松地检索数据。我使用的是一个开源数据库,而’leave‘表是由me.is创建的,原因是什么??实际上我没有找到任何问题的原因,我使用的是mysql_fetch_row(),但是我有一个错误,如下所示
警告: C:\xampp\htdocs\attendance_system\admin_leave.php ()期望参数1是资源,在第42行的mysql_fetch_row中给出布尔值 您的SQL语法出现了错误;请检查与您的MySQL服务器版本对应的手册,以便在第1行使用接近“休假”的正确语法。
这是我的code...please帮我
代码在这里
<?php
/*@session_start();
if (isset($_SESSION['username']) && $_SESSION['username']) {
} else {
header("Location: index.php");
}
$title = 'Leave Application';*/
include_once 'config.php';
include('header.php');
?>
<div class="grid_12">
<div class="contentpanel">
<h2 align="center">Leave Application</h2>
<?php
$sql = mysql_query('select * from leave');
?>
<table class="list" cellspacing="0" cellpadding="5" border="1">
<thead>
<tr>
<th> </th>
<th>Employee ID</th>
<th>Employee Name</th>
<th>User Name</th>
<th>Leave Days</th>
<th>Start Date</th>
<th>End Date</th>
<th>Reason</th>
</tr>
</thead>
<tbody>
<?php
while($w= mysql_fetch_row($sql) or die(mysql_error()))
{
echo
"<tr>
<td> </td>
<td>".$w[0]."</td>
<td>".$w[1]."</td>
<td>".$w[2]."</td>
<td>".$w[3]."</td>
<td>".$w[4]."</td>
<td>".$w[5]."</td>
<td>".$w[6]."</td>
</tr>";
}
?>
</tbody>
</table>
<br/>
<br/>
</div>
</div>
<?php include('footer.php'); ?>发布于 2013-04-21 03:17:40
https://stackoverflow.com/questions/16127591
复制相似问题