why cant i do this

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

why cant i do this

Post 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?
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post 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.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

sorry, it does work, my second "monday" post this monday. this is getting rediculous
Post Reply