$sql="delete  from cs_table where id='".$_GET[id]."'";
$dele=$msg->find_primary_key($sql);
print_r($dele); public function del($table,$id,$col="")
{
if(!$col)$col=$this->find_primary_key($table);
if (is_array($id))
{
$ids=implode(",",$id);
$sql="delete from `$table` where $col in (".$ids.")";
}else
{
$sql="delete from `$table` where $col=$id";
}
if(!$msg=$this->query($sql))
{
$this->err($sql);
}
return $msg;
}  {foreach item=user from=$info }
  <tr>
    <td>{$user.name}</td>
    <td colspan="8">{$user.address}</td>
    <td colspan="2">{$user.sex}</td>
    <td colspan="2"><div align="center"><a href="?id={$user.id}">修改</a></div></td>
    <td><div align="center"><a href="?id={$dele.id}">删除</a></div></td>
  </tr>
  {/foreach}本人菜鸟  求救啊

解决方案 »

  1.   

    ....你的代码,看的好迷糊。$sql="delete from cs_table where id='".$_GET[id]."'";
    $dele=$msg->find_primary_key($sql);
      

  2.   

    不对啊    Fatal error: Call to a member function find_primary_key() on a non-object in C:\wamp\www\SMA\php\index.php on line 13
      $msg->find_primary_key($sql);  13行
      

  3.   

    查看页面源代码,看看<a href="?id={$dele.id}">删除</a>红色部分是啥东西
      

  4.   

    $smarty->assign("dele",$dele);  smarty的模板
      

  5.   


    你传过去的不是一个对象...
    你能贴下你的find_primary_key方法吗?
      

  6.   

    public function del($table,$id,$col="")
    {
    if(!$col)$col=$this->find_primary_key($table);
    if (is_array($id))
    {
    $ids=implode(",",$id);
    $sql="delete from `$table` where $col in (".$ids.")";
    }else
    {
    $sql="delete from `$table` where $col=$id";
    }
    if(!$msg=$this->query($sql))
    {
    $this->err($sql);
    }
    return $msg;
    }