Re: Different MSSQL output date format from the same PHP script
- From: Willem Bogaerts <w.bogaerts@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 19 Feb 2008 13:03:43 +0100
SELECT * is not a good thing to use. You are much better off always
specifying the columns.
For one thing, it's very seldom you need all of the columns.
Why put columns in a table if you are not interested in them? It is
really rare and a sign of bad datase stucture if a table contains things
I do not want to select.
But more
importantly, what happens if someone later adds a new column to the
table (i.e. a 5mb BLOB)?
Well, first of all, that would be me. If I would add such a column, I
would have a need for it. If that field would only be vaguely connected
to the rows in that table, it would be in an only vaguely connected table.
So what happens? I would update the mapping table and a template and I
would have an extra field on my web form. Without the need to modify the
code. That is why ORM layers exist, is it not?
Also, if someone later deletes or renames a current column, the query
will fail, making the problem very obvious.
On the contrary, "SELECT *" will NOT fail. Just update your ORM settings
and all of your code knows it. Your php code will be less hard-wired to
the database structure, which is a good thing.
Otherwise you may not even
get an error message, depending on your error settings - just incorrect
output, which may or may not be noticed for a while.
I am getting more errors than I am happy with in such a case, I can
assure you. ;)
Regards,
--
Willem Bogaerts
Application smith
Kratz B.V.
http://www.kratz.nl/
.
- Follow-Ups:
- Re: Different MSSQL output date format from the same PHP script
- From: Charles Calvert
- Re: Different MSSQL output date format from the same PHP script
- From: Jerry Stuckle
- Re: Different MSSQL output date format from the same PHP script
- References:
- Different MSSQL output date format from the same PHP script
- From: Alessandro
- Re: Different MSSQL output date format from the same PHP script
- From: Toby A Inkster
- Re: Different MSSQL output date format from the same PHP script
- From: Alessandro
- Re: Different MSSQL output date format from the same PHP script
- From: Jerry Stuckle
- Different MSSQL output date format from the same PHP script
- Prev by Date: Re: How do I pass an array key from a multi-dimensional array to a new array?
- Next by Date: Re: mysql_real_escape_string
- Previous by thread: Re: Different MSSQL output date format from the same PHP script
- Next by thread: Re: Different MSSQL output date format from the same PHP script
- Index(es):