ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Data insert into database from notepad

April 06, 2012 6:58pm

Subscribe [1]
  • #1 / Apr 06, 2012 6:58pm

    Farzand

    5 posts

    i m working on amazon ECS api so i upload asin from notepad and insert into database.then asin search form amazon.
    so now i m trying to insert asin into database via notepad. here is my code
    $data = array(
            ‘category_id’=> $this->input->post(‘state’),
            ‘title’=> $this->input->post(‘title’),
            ‘date_created’ => date(‘Y-m-d H:i:s’),
            ‘date_modified’ => date(‘Y-m-d H:i:s’)
          );
      $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));
    }     
          }
          }
    but data can`t insert into database.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases