我想编辑一个基于FileNo的记录集,该记录集与另一个以fileno作为链接字段的表链接。我在这里提供了两组代码,一组是工作,另一组是代码错误。
工作代码:
$sql="SELECT * FROM casedt WHERE AdvUser= '".$_SESSION['MM_Username']."' && FileNo = $fileno ";
$result= mysqli_query($link, $sql) or die ('Unable to run query:'.mysql_error());
#$count=mysqli_num_rows($result);
$row = mysqli_fetch_array($result);
echo "<table border='1'><tr><th>Adv User</th><th>File No.</th><th>Next Dt</th><th>Comments</th><th></th></tr>";
// output data of each row
while($row = mysqli_fetch_assoc($result))
{
echo "<tr><td>".$row["AdvUser"]."</td><td>".$row["FileNo"]."</td><td>".$row["NextDt"]."</td><td>".$row["Comments"]."</td></tr>";
}
非工作代码:
$sql="SELECT * FROM casedt WHERE AdvUser= '".$_SESSION['MM_Username']."' && FileNo = $fileno ";
$result= mysqli_query($link, $sql) or die ('Unable to run query:'.mysql_error());
#$count=mysqli_num_rows($result);
$row = mysqli_fetch_array($result);
echo "<table border='1'><tr><th>Adv User</th><th>File No.</th><th>Next Dt</th><th>Comments</th><th></th></tr>";
// output data of each row
while($row = mysqli_fetch_assoc($result))
{
echo "<tr><td>".$row["AdvUser"]."</td><td>".$row["FileNo"]."</td><td>".$row["NextDt"]."</td><td>".$row["Comments"]."</td><td><a href=EditDate.php?recordID= .$row['FileNo'] Edit</a></td</td></tr>";
}