Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public function addhw(){
$array=array('hw_name'=>$_POST['hw_name'],
'hw_description'=>$_POST['hw_description'],
'hw_model'=>$_POST['hw_model'],
'hw_serialno'=>$_POST['hw_serialno'],
'hw_manufacturer_id'=>$_POST['manufacturer_id'],
'hw_picture'=>'includes/images/hardware_logo.png'
);
$query=$this->db->insert('hardware', $array);
$last_id=$this->db->insert_id();
if($_POST['hw_type'] == 'RAM' || $_POST['hw_type'] == 'Graphics Card'){
$array1=array('hardware_id'=>$last_id,
'memory_type'=>$_POST['memory_type'],
'memory_size'=>$_POST['memory_size']);
$query1=$this->db->insert('hardware_memory',$array1);
if(!$query1){
echo mysqli_error($query1);
}else{return $query;}
}
return $query;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment