title: No product was added to database
body: <p>I fixed Warning error but no product was added to my database.
  I don't know what my fault is? Hope that anyone can help me</p>
  
  <p>Here is my code in add.php: </p>
  
  <pre><code>if ($_POST) {
  // Image 1
  $image_name_1 = $_FILES ['image_1'] ['name'];
  $image_type_1 = $_FILES ['image_1'] ['type'];
  $image_size_1 = $_FILES ['image_1'] ['size'];
  $image_tmp_name_1 = $_FILES ['image_1'] ['tmp_name'];
  
  if ($image_name_1 == '' || $image_name_1 == null) {
      echo "&lt;script&gt; alert('Please select an image')&lt;/script&gt;";
  } else
      move_uploaded_file ( $image_tmp_name_1, '../../userfiles/' . $image_name_1 );
  
      // Image 2
  $image_name_2 = $_FILES ['image_2'] ['name'];
  $image_type_2 = $_FILES ['image_2'] ['type'];
  $image_size_2 = $_FILES ['image_2'] ['size'];
  $image_tmp_name_2 = $_FILES ['image_2'] ['tmp_name'];
  
  if ($image_name_2 == '' || $image_name_2 == null) {
      echo "&lt;script&gt; alert('Please select an image')&lt;/script&gt;";
  } else
      move_uploaded_file ( $image_tmp_name_2, '../../userfiles/' . $image_name_2 );
  
      // Image 3
  $image_name_3 = $_FILES ['image_3'] ['name'];
  $image_type_3 = $_FILES ['image_3'] ['type'];
  $image_size_3 = $_FILES ['image_3'] ['size'];
  $image_tmp_name_3 = $_FILES ['image_3'] ['tmp_name'];
  
  if ($image_name_3 == '' || $image_name_3 == null) {
      echo "&lt;script&gt; alert('Please select an image')&lt;/script&gt;";
  } else
      move_uploaded_file ( $image_tmp_name_3, '../../userfiles/' . $image_name_3 );
  
  $data = array (
          'category_id' =&gt; $_POST ['category_id'],
          'name' =&gt; $_POST ['name'],
          'price' =&gt; $_POST ['price'],
          'detail' =&gt; $_POST ['detail'],
          'img_1' =&gt; $image_name_1,
          'img_2' =&gt; $image_name_2,
          'img_3' =&gt; $image_name_3,
          'status' =&gt; isset ( $_POST ['status'] ) ? 1 : 0,
          'created' =&gt; date ( 'Y-m-d H:i:s' ),
          'modified' =&gt; date ( 'Y-m-d H:i:s' ) 
  );
  
  
  if (add_product ( $data )) {
      $_SESSION ['success'] = true;
      // rdr to list.php
      header ( 'location:list.php' );
  }
   }
  </code></pre>
  
  <p>Here is <strong>add-form</strong></p>
  
  <pre><code>&lt;form name="add" method="POST" enctype="multipart/form-data" action=""&gt;
      &lt;table class="table table-hover"&gt;
          &lt;tr&gt;
              &lt;th&gt;Category&lt;/th&gt;
              &lt;th&gt;&lt;select name="category_id"&gt;
                  &lt;?php while($category_active = mysql_fetch_assoc($category_active_list)): ?&gt;
                  &lt;option
                          value="&lt;?php echo $category_active['category_id']; ?&gt;"&gt;&lt;?php echo $category_active['name']; ?&gt;&lt;/option&gt;
                  &lt;?php endwhile; ?&gt;
                  &lt;/select&gt;&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;th&gt;Product Name&lt;/th&gt;
              &lt;th&gt;&lt;input type="text" name="name" value="" /&gt;&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;th&gt;Detail&lt;/th&gt;
              &lt;th&gt;&lt;textarea name="detail"&gt;&lt;/textarea&gt;&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;th&gt;Image&lt;/th&gt;
              &lt;th&gt;&lt;input type="file" name="image_1" /&gt;&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;th&gt;Image 2&lt;/th&gt;
              &lt;th&gt;&lt;input type="file" name="image_2" /&gt;&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;th&gt;Image 3&lt;/th&gt;
              &lt;th&gt;&lt;input type="file" name="image_3" /&gt;&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;th&gt;Price&lt;/th&gt;
              &lt;th&gt;&lt;input type="text" name="name" value="" /&gt;&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;th&gt;Status&lt;/th&gt;
              &lt;th&gt;&lt;input type="checkbox" name="status" value="1" /&gt;&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;th&gt;&lt;/th&gt;
              &lt;th&gt;&lt;input type="submit" value="Add" name="btnAdd" /&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and <strong>function add</strong></p>
  
  <pre><code>function add_product($data) {
  // SQL
  $sql = "INSERT INTO tbl_product(category_id, name, price,detail, img_1, img_2, img_3, status, created, modified) VALUES({$data['category_id']}, '{$data['name']}', {$data['price']}, '{$data['detail']}', '{$data['image_1']}', '{$data['image_2']}', '{$data['image_3']}', {$data['status']}, '{$data['created']}', '{$data['modified']}')";
  return mysql_query ( $sql );
  }
  </code></pre>
  
  <p>How to fix it?.Tks all</p>