I am new to PHP. What i am trying i have performed insertion and i will have to grab the its id so i used ;insert_lastid(); function which is same as mysqli_last_insert_id ,so dont get confused with it .i tried to hold that last id on basis of last id i will perform select operation in another function Here is the code which will clear more my problem . This function is for insertion
public function cars_insert($_POST,$path) {
$this->insert_query="insert into `_cars` (`_year`,`_make`,`_model`,`_version`,`_city`,`_color`,`_mileage`,`_engine_capacity`, `_engine_type`,`_assembly`,`_image`)VALUES('" .$_POST['year'] . "','" .$_POST['make'] . "','" .$_POST['model'] . "','" .$_POST['version'] . "','" .$_POST['city'] . "','" .$_POST['color'] . "','" .$_POST['mileage'] . "','" .$_POST['engine_capacity'] . "','" .$_POST['engine_type'] . "','" .$_POST['assembly'] . "','" .$path . "')";
return $this->insert();
global $car;
$this->car=insert_lastid();
}
Here it is the second function it will Select on basis of insert_lastid();
public function cars_id($this->car){
$this->select_query="SELECT * FROM `_cars` WHERE `_id`='$this->car'";
return $this->select();
}
programmingfrom BOOKS not SO. SO should be used for edge cases :) not most basic of basic things.