This reminded me of an issue I've kind of been contemplating
for a couple of weeks now... I got sick of having to
connect, query, check for errors, etc. every time I wanted
to query a mysql database, so I wrote a function to do all
of it for me... something like:

function query_db($queryString, $file, $line) {
    // do db stuff
    // if error, die using $file and $line (actually using
constants __FILE__ and __LINE__ only tell me that it died in
this function)
    // return results of query
}

Now, to call the function I've been using:

$result = query_db("SELECT * FROM myTable", __FILE__,
__LINE__);

It'd be nice to be able to get __FILE__ and __LINE__ where
the function was called without passing them as parameters.
Even if I could just define a macro _HERE_ to expand into
__FILE__, __LINE__ it would save me some time...

I know it sounds lazy, but if there was a way so I could
just call

$result = query_db("SELECT * FROM myTable");

it'd be so much nicer...

PS - I don't want to get into db abstraction and all that...
I just wonder if what I'm talking about is easy/possible.

Thanks for input -

--Toby

----- Original Message -----
From: "Moritz Petersen" <[EMAIL PROTECTED]>
Sent: Wednesday, January 10, 2001 3:18 PM
Subject: RE: [PHP] constants inside of a string

<snip>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to