Error: Column count doesn't match value count at row 1

Recommended Answers

All 2 Replies

You need to provide some code so that we can help you

// type determine 
    if($_REQUEST[style_type]=="Clothes")
        {
        $type = "Clothes";
        }
        else if($_REQUEST[style_type]=="Skincare")
        {
        $type = "Skincare";
        }
        else if($_REQUEST[style_type]=="Accessories")
        {
        $type = "Acccessories";
        }
        else
        {
        $type = "Select From Categories";
        }

    // get data 
    $id= $_POST[id];
    $name = $_POST[name];
    $product_qty = $_POST[product_qty];
    $price = $_POST[price];
    $description = $_POST[description];

    $st_id=$_REQUEST[index]."-".$_REQUEST[product_category];

    //add data
    if ($_POST[Submit]==Add){
         $search = mysql_query("SELECT id FROM shop WHERE name='$name' && product_category='$_REQUEST[product_category]' " ); 


    if(mysql_fetch_array($search)==0)
                   { 
                    // Image Load 

                          $st_id_img=$id.".png";
                          $sfile = $_FILES['img']['tmp_name']; 
                           $dfile = "img/products/".$st_id_img; 
                            copy($sfile, $dfile);


            $sql= "INSERT INTO shop(id, img, name, description, price, product_qty, product_category)      
                   VALUES('$st_id','$dfile','$name', '$descrition','$price' '$product_qty','$_REQUEST[product_category]' )";
                   if (!mysql_query($sql, $con)){die('Error: ' . mysql_error());}
                            else
                           $msg= "Record is added Successfully";
                   }
                   else


                          $msg= "Record is Already Exist";
         }
    if ($_POST[Submit]=="Update")
   {

       // Image Load 

                          $st_id_img=$st_id.".png";
                          $sfile = $_FILES['img']['tmp_name']; 
                           $dfile = "img/products/".$st_id_img; 
                            copy($sfile, $dfile);


    $sql = "UPDATE tb_style SET name='$_REQUEST[name]', 
                                product_qty='$_REQUEST[style_qty]', 
                                description='$_REQUEST[description]', 
                                price='$_REQUEST[price]',
                                img='$dfile'  
                                WHERE id ='$_REQUEST[id]' ";
                                    if (!mysql_query($sql, $con))
                                                  { die('Error: ' . mysql_error());}
                                           else $msg= "Record is Updated Successfully";
  }          


if ($_POST[Submit]=="Delete")
   {
    $st_id_img=$_REQUEST[id].".png";
   unlink($image);

    $sql = "Delete from shop WHERE id ='$_REQUEST[id]' ";
                                    if (!mysql_query($sql, $con))
                                                  { die('Error: ' . mysql_error());}
                                           else $msg= "Record is Delete Successfully";
  }                                        








$cc= mysql_query("Select *from  shop",$con); //check how many records exists in the database
  $count_mem=mysql_num_rows($cc);

   if ($count_mem==0)
    { 
    $index=1;


    }
    else
      { 
       $index=$count_mem+1;

      }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.