/    Sign up×
Community /Pin to ProfileBookmark

PHP error column issue

Hi

I added extra fields following the link below

[url]http://www.webidsupp….ight=condition[/url]

I get the following error after pressing submit

An unexpected error occurred. The error has been forwarded to our technical team and will be fixed shortly

I checked the error log just now in admin ->tools and has the following

Ford Mondeo

‘, ”, 198, 0, ‘299’, ‘0’, ‘0’, ‘299’, ‘1’, ‘1’,
‘1’, ‘2’, ‘Array’, ‘Silver’, ‘3’, ‘2’, ‘1’, ‘0’, ‘2’, ‘1’, 0, ‘1367774117’, 0, 0, 1, 1, 0, 0, 0, 0, ‘n’, ”, ‘y’, ‘n’, ‘n’, ‘n’, 0.00)
Column count doesn’t match value count at row 1
page:/home/sites/247autotrade.com/public_html/sell.php line:108

I found it is because I have a field short in the coding I am guessing as also found out there are more database columns than there are values, is that right? if so just unsure how to correct it

I have been trying to fix it for ages but can’t seem to do it

Is it to do with the coding below

[code=php]
return “INSERT INTO ” . $DBPrefix . “auctions VALUES (NULL, ” .$user->user_data[‘id’] . “, ‘” .
$system->cleanvars($_SESSION[‘SELL_title’]) . “‘, ‘” . $system->cleanvars($_SESSION[‘SELL_subtitle’]) . “‘, ‘” . $a_starts . “‘, ‘” . addslashes($_SESSION[‘SELL_description’]) . “‘, ‘” . $system->cleanvars($_SESSION[‘SELL_pict_url’]) . “‘, ” . $_SESSION[‘SELL_sellcat1’] . “, ” . intval($_SESSION[‘SELL_sellcat2’]) . “, ‘” . $system->input_money(($_SESSION[‘SELL_buy_now_only’] == ‘n’) ? $_SESSION[‘SELL_minimum_bid’] : $_SESSION[‘SELL_buy_now_price’]) . “‘, ‘” . $system->input_money($_SESSION[‘SELL_shipping_cost’]) . “‘, ‘” . $system->input_money(($_SESSION[‘SELL_with_reserve’] == ‘yes’) ? $_SESSION[‘SELL_reserve_price’] : 0) . “‘, ‘” . $system->input_money(($_SESSION[‘SELL_with_buy_now’] == ‘yes’) ? $_SESSION[‘SELL_buy_now_price’] : 0) . “‘, ‘” . $_SESSION[‘SELL_atype’] . “‘, ‘” . $_SESSION[‘SELL_condition’] . “‘,
‘” . $_SESSION[‘SELL_make’] . “‘, ‘” . $_SESSION[‘SELL_model’] . “‘, ‘” . $_SESSION[‘SELL_number_doors’] . “‘, ‘”
. $_SESSION[‘SELL_colour’] . “‘, ‘” . $_SESSION[‘SELL_year’] . “‘, ‘” . $_SESSION[‘SELL_fuel_type’] . “‘, ‘”
. $_SESSION[‘SELL_duration’] . “‘, ‘” . $system->input_money($_SESSION[‘SELL_customincrement’]) . “‘, ‘” . $_SESSION[‘SELL_shipping’] . “‘, ‘” . $payment_text . “‘, ” . (($_SESSION[‘SELL_international’]) ? 1 : 0) . “, ‘” . $a_ends . “‘, 0, 0, ” . (($_SESSION[‘SELL_file_uploaded’]) ? 1 : 0) . “, ” . $_SESSION[‘SELL_iquantity’] . “, 0, ” . intval($_SESSION[‘SELL_relist’]) . “, 0, 0, ‘n’, ‘” . $system->cleanvars($_SESSION[‘SELL_shipping_terms’]) . “‘, ‘” . $_SESSION[‘SELL_buy_now_only’] . “‘, ‘” . $_SESSION[‘SELL_is_bold’] . “‘, ‘” . $_SESSION[‘SELL_is_highlighted’] . “‘, ‘” . $_SESSION[‘SELL_is_featured’] . “‘, ” . $fee . “)”;
}
[/code]

Thank you in advance

Kind regards

Ian

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMay 05.2013 — There must be the exact same number of values as columns, but you can specify the exact columns you are providing values for if you are not sending a value for every column in the table. In fact, it's generally best to specify every column to be used anyway even if you're supplying a value for every column, just in case the column order is changed or new, optional columns are added, etc.
<i>
</i>INSERT INTO table_name (
col_1, -- here is where we specify the columns
col_2,
col_3
)
VALUES (
123, -- this is where we provide their values
'foo',
'bar'
)

Also, if you make generous use of newlines in your SQL (such as I did above), it makes it easier to visually check your source code to ensure you have the same number of columns and values, and that each value is associated with the correct column. ?
×

Success!

Help @ianhaney spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...