删除行时出错

时间:2013-12-15 04:30:46

标签: php

任何人都知道这个问题我不能删除表格中的行吗?

<?php $cus = mysql_query("SELECT * FROM priest") or die(mysql_error()); ?>

<?php WHILE($row = mysql_fetch_array($cus)){
  $id = $row['p_id'];
  $pid = $row['p_id'];
  $fname = $row['firstname'] . "&nbsp;" .$row['middlename']. "&nbsp;" . $row['lastname'];
}

?>

<tr class="gradeA del<?php echo $id;?>">
  <td><?php echo $pid; ?></td>
  <td><?php echo $fname; ?></td>

  <td><a  href ='priest_list.php'>
      <img src='images/delete.png' title='Delete Priest' height='23'></a></td>

我在代码下面添加了这个:

这是我的connect.php中的代码,我的函数是

<?php  
$conn = mysql_connect('localhost', 'root', '');

 if (!$conn)
{
 die('Could not connect: ' . mysql_error());
}

mysql_select_db("rain_scheduling_system", $conn) or die('Could not Select: '.mysql_error());

function delete_priest($a)
{
  mysql_query("DELETE FROM priest WHERE p_id ='$a' ");
}
?>

0 个答案:

没有答案