On Tue, Jan 06, 2004 at 05:33:41PM -0500, joel boonstra wrote:
<snip>
> I would recommend not simply doing a select *, but rather specifying
> which columns you want.  That way, if your database schema changes
> (e.g., you add two more columns), your code won't break.

And, responding to myself, specifying your columns is also good practice
because MySQL makes no guarantees about the order that columns are
returned when you say "SELECT *".  Today, it may well be the order that
you specified when you created your table.  With the next upgrade, it
may be alphabetical order, or by column type, or some other order that
the software chooses.  If you specify column names in your SELECT
statement, you don't need to worry about it.  This is especially
important when you are using list() to assign variables based on their
position in your fetched array.

joel

-- 
[ joel boonstra | gospelcom.net ]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to