I am having a problem with getting the value of an auto incremented column=reservation_no on table reserves

function add_new_reservation($reservation_no,$user_id,$date_from,$date_to,$location,$comments,$items = array()) { $user_id=$this->session->userdata('user_id'); $data=array( 'user_id'=> $user_id, 'date_from'=>$date_from, 'date_to'=> $date_to, 'location'=> $location, 'comments'=>$comments ); $this->db->insert('reserves',$data); $query = "SELECT max(reservation_no) as mx from reserves where user_id =2"; $query = $this->db->query($query); foreach ($query->result() as $row){ $res_no = $row->mx; for($x = 0; $x db->query($sql); } } } ==i have tried using max function to get the last reservation number.. i have reserves table and reserved_items table..i have to get the reservation_no value of reserves to insert it on reservation_no of reserved_items.. kindly, help me out with this one?:(
Tags

..when i try this script for uploading images for local ok naman pero pag sa domain na may error na.. if ($error > 0) { die("Error uploading file! Code $error.");} else { if($size > 1028) { die("Format is not allowed or file size is too big!"); } else { move_uploaded_file($temp,"Upload/".$name); } header("Location:index.php"); exit; } }

Add new comment