.

.

Last Insert Id In Pdo

 $lastId = $this->db->lastInsertId();

 public function addcategory($post,$anm)
 {

 $catname=str_replace("'","`",$_POST['cat_name']);

 $slug=$this->create_slug($catname);

 $sql="INSERT INTO `great_category` (`parent`, `cat_type`, `categoryname`,`uploadimage`,`cat_slug`, `adddate`, `editdate`, `displayflag`,  `add_user`) VALUES ('0','category','".$catname."','".$anm."','".$slug."',NOW(),Now(),'".$_POST['status']."','admin')";


 $query=$this->db->prepare($sql);
 

$query->execute();
$lastId = $this->db->lastInsertId();
return $lastId;






 }


EmoticonEmoticon