User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 426,425 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,400 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting

OOPing with PHP4 simple DB connect class?

Join Date: Nov 2007
Posts: 86
Reputation: sagedavis is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 6
sagedavis sagedavis is offline Offline
Junior Poster in Training

Re: OOPing with PHP4 simple DB connect class?

  #3  
Mar 28th, 2008
Thanks for this tute, it's pretty good, although, I wouldn't recommend a beginning OOPer to read that right off the bat.

I've been working with PHP OOPing for only a short time, but, as it's a daily requirement in my job, I find your stuff easier to follow than our own docs at work.

The only thing is that I have never seen anything like line 17 before.
function flowSQL($db_server = DATABASE_SERVER, $db_user = DB_USERNAME, $db_pass = DB_PASSWORD, $database = DATABASE)
is this a PHP5 thing?
I don't have access to 5 at the moment, err... scratch that.. I don't have access on the server that I am creating this for, to PHP5.

I am assuming that, this line must stay as is, however, we need to use
define('DATABASE_SERVER', 'localhost');

another item I am assuming is PHP5 which does not work in 4, as I have never seen it in a PHP4 script.

further assumption is that, if I actually did all the defines, that this would globally define these items as long as I use some require page.php.

At which point I would be able to do something like
$query = "SELECT needle FROM haystack WHERE hay = yellow";
$myQuery = new flowSQL;
$myQuery->flowSQL();
$myQuery->query($query);

or is it even needed to use the second to last line?

Thanks again for your help
Sage
Reply With Quote  
All times are GMT -4. The time now is 2:17 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC