Welcome Guest, Not a member yet? Register   Sign In
Insert data into database from notepad file
#1

[eluser]Farzand[/eluser]
i am working on amazon ECS api . so i upload asin from notepad file and insert asin into database then asin search product from amazon. i try to insert asin into database but its failed.here is my code

$data = array(
'category_id'=> $this->input->post('state'),
'title'=> $this->input->post('title'),
'date_created' => date('Y-m-d H:iConfused'),
'date_modified' => date('Y-m-d H:iConfused')
);
$this->db->insert($this->product_list,$data);
$id = $this->db->insert_id();
$asins = array();
$images = $this->do_upload("productasins");
if($images['file_name'] !="")
{
$images = $images['file_name'];
} else {
$images = 'no';
}
if(!empty($images)){
$path = './public/files/'.$images;
$asin_file = file_get_contents($path);

$str_products = $this->input->post('productasins') . ' ' . $asin_file;
}else{
$str_products = $this->input->post('productasins');
}
$products = preg_split("/[\s,]+/", $str_products);
foreach ($products as $product_asin) {
$product_asin = trim($product_asin);
if ($product_asin != "") {
$this->db->where( array('asin' => $product_asin));
$product = $this->db->get('product');
if ($product == null) {
$data = array(
'asin' => $product_asin,
'product_list_id' => $id
);
print_r($this->db->insert('product',$data));
}
}
}



Messages In This Thread
Insert data into database from notepad file - by El Forum - 04-06-2012, 04:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB