Page 1 of 1

[SOLVED] - Show Errors

Posted: Sun Jan 28, 2007 9:07 am
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.

Posted: Sun Jan 28, 2007 9:14 am
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.

Posted: Sun Jan 28, 2007 9:47 am
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.

Posted: Sun Jan 28, 2007 10:41 am
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.

Posted: Sun Jan 28, 2007 12:03 pm
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.

Posted: Sun Jan 28, 2007 5:27 pm
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.

Posted: Sun Jan 28, 2007 11:20 pm
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.