0

column count doesn't match value count at row 1

$objhelperClass->insert(PRODUCT,"catid,subcat,pname,price,sort_order,description","'".$_POST['cat']."','".$_POST['subcat']."','".$_POST['pname']."','".$_POST['amount']."','".$_POST['sort']."'");

$m=$objhelperClass->select(PRODUCT,"1","max(`id`)");
$pid=$m['max(`id`)'];

if(is_array($patas))
{
        foreach(array_combine($patas,$thumbs) as $val => $val1)
        {
            //echo $val;
            $objhelperClass->insert(IMAGES," `image`,`thumb`,`pid`,`link` ","'".$val."','".$val1."','".$pid."' ");
        }
}
2
Contributors
3
Replies
14
Views
2 Years
Discussion Span
Last Post by hericles
0

That error means you haven't listed your columns correctly and you're trying to insert more or less fields than you have specified columns.
You list image, thumb, pid and link as columns but have only listed $val, $avl1 and $pid to match them.

0

ok thanks for the reply but can you tell me how to procees as I am new to this

0

Simply make sure that for each column you have listed as a target you have a corrsponding value being entered. As a basic SQL example, this won't work:

UPDATE products(col1, col2, col3, col4) VALUES('1','2','3');

because a value is missing for one of the specified columns. In your example I pointed you to the missing $link variable.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.