[thelist] Rusty PHP questions...

Joel D Canfield joel at streamliine.com
Mon Oct 15 10:44:17 CDT 2007


> 1. One best practice is to never use SELECT * - could someone 
> explain why,
> and tell me when this is okay if ever? Right now I am doing this:

my primary argument is future needs: listing all the columns makes it
really easy to change from 'select * ' to 'select * except for column
13' which you can't do. it's also self-documenting. right there in your
code you've got all the column names, when you come back in six weeks to
adjust something.

> 2. They are connecting to the db directly in the page code, 
> which I know is
> a no-no - is the best way to do this simply to have an include like '
> connect.php'? 

I know less PHP than you, Tom, but from an ASP perspective, it's
cleaner, safer, and more efficient to put the db connection in an
include, as you suggest here

joel



More information about the thelist mailing list