[thelist] mySQL/PHP class function (maybe another stupid question)

Matt Warden mwarden at gmail.com
Mon Jul 11 10:36:58 CDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nan Harbison wrote:
> Hello,
> 
> I am still slogging through thousands of lines of code I didn't write try to
> find the bugs in the code that makes the website not function as it is
> supposed to.
> In the database class (which mainly makes it easier to switch the type of DB
> being used), there is the funtion:
> 
> function query($query, $file="", $line="", $type=DB_TYPE)
> 
> and when this function is called, the call looks like this:
> 
> if ($r = $this->db->query($q, __FILE__, __LINE__))
> 
> so what the heck are these:
> 
> __FILE__
> and
> __LINE__
> 
> I am completely lost on this. Sorry if this is a stupid question.

Not stupid, but google is your friend :)

Anyway, these are so-called "magic constants" that PHP sets itself.
Refer to:

http://docs.php.net/en/language.constants.html

THe two above are, respectively, the full path to the current file
(i.e., the path to the include file, if it is an include), and the
current line number. This is probably for logging or error reporting
(i.e., "there was an error in your query $sql issues on line $line in
file $file", where the latter two are passed with your function call
above).

HTH,


- --
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFC0pIaAQ0d4HGyPE8RAq1nAJ90EvFeOaoYK4YLiYy5J9sIC1lAbQCbBd+k
OStKCXLhEoXTRU6L8cz+kqE=
=N1zc
-----END PGP SIGNATURE-----


More information about the thelist mailing list