Page 1 of 1

why cant i do this

Posted: Tue Jul 19, 2005 10:05 am
by shiznatix
i have a class with a query function which simply does mysql_query or die ok easy but what i want is the good debuging stuff so i want it to look like this

Code: Select all

function query($query, $line, $file)
{
    $do_query = mysql_query($query) or die(mysql_error().'  '.$line.'-'.$file);
    return $do_query;
}

$query = 'asgasgdsg';

query($query, __LINE__, __FILE__);
but when i put in the line file things they dont go through to the function and it just ends up as nothing. why?

Posted: Tue Jul 19, 2005 10:26 am
by nielsene
(Sorry don't have a PHP I can test with just this momment, but)

First try echo-ing out __LINE__/__FILE__ in the global scope to make sure they're getting set orginalls (I have seen some corrupted PHP's at times that don't set those constants).

Then try echo-ing out $line,$file inside the function, not as part of die, just to see if its receiving them.

Posted: Tue Jul 19, 2005 10:44 am
by shiznatix
sorry, it does work, my second "monday" post this monday. this is getting rediculous