[SOLVED] - Show Errors

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
iknownothing
Forum Contributor
Posts: 337
Joined: Sun Dec 17, 2006 11:53 pm
Location: Sunshine Coast, Australia

[SOLVED] - Show Errors

Post by iknownothing »

hey all,
I was just wondering how do I echo the reason why an INSERT INTO didn't work, at the moment I am just echoing that it didnt work, not WHY it didnt. I did a search on it, but dont really know how to explain it to get accurate results.
Last edited by iknownothing on Sun Jan 28, 2007 11:36 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

mysql_error() or its related functions in other databases?

It should be noted that it's generally not a good idea to have this sort of output in a production site as it can give away details that can compromise your server.
User avatar
iknownothing
Forum Contributor
Posts: 337
Joined: Sun Dec 17, 2006 11:53 pm
Location: Sunshine Coast, Australia

Post by iknownothing »

feyd wrote:mysql_error() or its related functions in other databases?

It should be noted that it's generally not a good idea to have this sort of output in a production site as it can give away details that can compromise your server.
I only need it while im developing it. Thanks.
User avatar
iknownothing
Forum Contributor
Posts: 337
Joined: Sun Dec 17, 2006 11:53 pm
Location: Sunshine Coast, Australia

Post by iknownothing »

Ok, by implementing this I have been given this error when trying to INSERT a row: "Column count doesn't match value count at row 1".

I've done some searching and it has all come up with some inconsistencies with the amount of values inserted, however, I has double checked mine and the Table holds 77 columns, and my Values count up to 77 also (with '' used for the auto incrementing ID).

Is there any other reason why this could be happening, maybe the fact that 77 columns is too many?

EDIT: SOLVED - Missed some commas.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

BTW, my suggestion is to first name the values you are going to insert into the table rather than just inputting every value. It saves you from any headache if you ever decide to change the structure of your table.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

77 columns is often a lot. The table design may benefit from some optimization, but it's hard to say without knowing the table schema and what each field is for.
User avatar
iknownothing
Forum Contributor
Posts: 337
Joined: Sun Dec 17, 2006 11:53 pm
Location: Sunshine Coast, Australia

Post by iknownothing »

It is quite messy, but needed unfortunately.

super!design, I am already doing what you have said, maybe I just explained it wrong.

Thanks for your help anyway guys.
Post Reply