Skip to content

Instantly share code, notes, and snippets.

@teresko
Forked from anonymous/gist:62d725f62d10a5348aee
Last active February 16, 2016 01:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teresko/2b199b9ae22a2a3526e1 to your computer and use it in GitHub Desktop.
Save teresko/2b199b9ae22a2a3526e1 to your computer and use it in GitHub Desktop.
<?php
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