error
i think im the only one getting this error because it hasnt been posted yet but i didnt edit anything in the code.
i get this error when i try to make a new item
QUERY ERROR: Column count doesn't match value count at row 1
Query was INSERT INTO items VALUES('',17,'test','test',1,1,1, '0', 'a:4:{s:4:\"stat\";s:6:\"energy\";s:3:\"dir\";s:3:\"pos\";s:8:\"inc_type\";s:6:\"figure\";s:10:\"inc_amount\";i:0;}', '0', 'a:4:{s:4:\"stat\";s:6:\"energy\";s:3:\"dir\";s:3:\"pos\";s:8:\"inc_type\";s:6:\"figure\";s:10:\"inc_amount\";i:0;}', '0', 'a:4:{s:4:\"stat\";s:6:\"energy\";s:3:\"dir\";s:3:\"pos\";s:8:\"inc_type\";s:6:\"figure\";s:10:\"inc_amount\";i:0;}', 0, 0, 10000, 0, 0, 0)
this is my new_item_submit function
function new_item_submit()
{
global $db,$ir,$c,$h;
if($ir['user_level'] > 2)
{
die("403");
}
if(!isset($_POST['itmname']) || !isset($_POST['itmdesc']) || !isset($_POST['itmtype']) || !isset($_POST['itmbuyprice']) || !isset($_POST['itmsellprice']))
{
print "You missed one or more of the fields. Please go back and try again.
> Back";
$h->endpage();
exit;
}
$itmname=$db->escape($_POST['itmname']);
$itmdesc=$db->escape($_POST['itmdesc']);
$weapon=abs((int) $_POST['weapon']);
$helmet=abs((int) $_POST['helmet']);
$boots=abs((int) $_POST['boots']);
$amulet=abs((int) $_POST['amulet']);
$braclet=abs((int) $_POST['braclet']);
$ring=abs((int) $_POST['ring']);
$special=abs((int) $_POST['special']);
if($_POST['itmbuyable'] == 'on') { $itmbuy=1; } else { $itmbuy=0; }
$efx1=$db->escape(serialize(array("stat" => $_POST['effect1stat'], "dir" => $_POST['effect1dir'], "inc_type" => $_POST['effect1type'], "inc_amount" => abs((int) $_POST['effect1amount']))));
$efx2=$db->escape(serialize(array("stat" => $_POST['effect2stat'], "dir" => $_POST['effect2dir'], "inc_type" => $_POST['effect2type'], "inc_amount" => abs((int) $_POST['effect2amount']))));
$efx3=$db->escape(serialize(array("stat" => $_POST['effect3stat'], "dir" => $_POST['effect3dir'], "inc_type" => $_POST['effect3type'], "inc_amount" => abs((int) $_POST['effect3amount']))));
$m=$db->query("INSERT INTO items VALUES('',{$_POST['itmtype']},'$itmname','$itmdesc',{$_POST['itmbuyprice']},{$_POST['itmsellprice']},$itmbuy, '{$_POST['effect1on']}', '$efx1', '{$_POST['effect2on']}', '$efx2', '{$_POST['effect3on']}', '$efx3', $weapon, $boots, $helmet, $amulet, $braclet, $ring)");
print "The {$_POST['itmname']} Item was added to the game.";
stafflog_add("Created item {$_POST['itmname']}");
}
and i dont know if this is needed but this is my sql dump for the items table, maybe its missing something that i cant figure out
CREATE TABLE IF NOT EXISTS `items` (
`itmid` int(11) NOT NULL auto_increment,
`itmtype` int(11) NOT NULL default '0',
`itmname` varchar(255) NOT NULL default '',
`itmdesc` text NOT NULL,
`itmbuyprice` int(11) NOT NULL default '0',
`itmsellprice` int(11) NOT NULL default '0',
`itmbuyable` int(11) NOT NULL default '0',
`effect1_on` tinyint(4) NOT NULL default '0',
`effect1` text NOT NULL,
`effect2_on` tinyint(4) NOT NULL default '0',
`effect2` text NOT NULL,
`effect3_on` tinyint(4) NOT NULL default '0',
`effect3` text NOT NULL,
`weapon` int(11) NOT NULL default '0',
`itmpic` varchar(255) NOT NULL,
`boots` int(11) NOT NULL default '0',
`helmet` int(11) NOT NULL default '0',
`breastplate` int(11) NOT NULL default '0',
`leggings` int(11) NOT NULL default '0',
`gloves` int(11) NOT NULL default '0',
PRIMARY KEY (`itmid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=99 ;