我想为我的类创建一个删除一条记录的方法,这里是源:
/* Delete One Record
* in @param (string) $tbl - name of the table
* in @param (int) $idn - id of record
* @return (int) - identifier of removed record
*/
public function DelOne($tbl,(int)$idn)
{
if ($result = $this->pdo->prepare("DELETE FROM `".$tbl."` WHERE `id`=:idn"))
{
$result->bindValue(":idn",$idn,PDO::PARAM_INT);
$result->execute();
}
}
我希望这个函数返回一个刚刚删除的记录的标识符,而不是标准的 TRUE/FALSE 组合。