vampireduff Posted July 13, 2009 Posted July 13, 2009 I have been trying to add new items and edit some items, now this used to work coz I have added a few and edited a few. but now when I try I get this message: QUERY ERROR: Column count doesn't match value count at row 1 Query was INSERT INTO items VALUES('',2,'Vampire Knuckle Duster','Knuckle Duster with two spike like teeth',14500,8000,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;}', 750, 0, 0) could anyone please tell me how to fix this Quote
plintu Posted July 13, 2009 Posted July 13, 2009 Re: need a little help please when you get that query usually it means that you are either trying to insert too many things into a table of your database and you don't have enough fields or you aren't inserting enough things into the table of your database! it would help if you list all the fields in your database under "items", from what I can see you are trying to insert 16 fields into the `items` table of your database, do you have 16 fields in your `items` table ? Quote
vampireduff Posted July 14, 2009 Author Posted July 14, 2009 Re: need a little help please Thanks for replying, I have 17 fields. I just added the itmPIC field so I can display Images of my items on my game. here is a list of the fields: 1) itmid 2) itmtype 3) itmPIC 4) itmname 5) itmdesc 6) itmbuyprice 7) itmsellprice 8) itmbuyable 9) effect1_on 10) effect1 11) effect2_on 12) effect2 13) effect3_on 14) effect3 15) weapon 16) armor 17) footware I added the footware field awhile ago but have got around to doing anything with it just yet. I hope to add footware and headware to my items at a later date to give more armour options. so how do I fix this? how do I tell the database to use more fields? Quote
Lithium Posted July 14, 2009 Posted July 14, 2009 Re: need a little help please You need to check for what is missing... and at a quick look... you're missing the 3) itmPIC meaning you will need to add that extra field on the edit items! Quote
plintu Posted July 14, 2009 Posted July 14, 2009 Re: need a little help please so in your staff_items under function new_item_form just below this: Item Name: <input type='text' name='itmname' value='' /> Item Desc.: <input type='text' name='itmdesc' value='' /> you need to add: Item img.: <input type='text' name='image' value='' /> then scroll down till you find: $itmname=$db->escape($_POST['itmname']); $itmdesc=$db->escape($_POST['itmdesc']); and add: $image=$db->escape($_POST['image']); then under editing item you need to find this: Item Name: <input type='text' name='itmname' value='{$itemi['itmname']}' /> Item Desc.: <input type='text' name='itmdesc' value='{$itemi['itmdesc']}' /> and add: Item img.: <input type='text' name='image' value='{$itemi['image']}' /> then in function edit_item_sub find: $itmname=$_POST['itmname']; $itmdesc=$_POST['itmdesc']; and add: $image=$_POST['image']; and that should fix you right up! Quote
vampireduff Posted July 14, 2009 Author Posted July 14, 2009 Re: need a little help please Cheers mate, will try that :) Quote
plintu Posted July 14, 2009 Posted July 14, 2009 Re: need a little help please Cheers mate, will try that :) no problem I did the same exact modification to my game so I already have it all like that, I just don't know if I got you everything so let me know if that works for ya! waiting to here back from you! Quote
vampireduff Posted July 14, 2009 Author Posted July 14, 2009 Re: need a little help please just needed a little extra code in a line that holds '$itmname' I add the img code to that line and with the others you told me about, now everything works fine. thanks :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.