Strange behavior of function die()

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
alkz
Forum Newbie
Posts: 1
Joined: Thu Apr 01, 2010 12:53 pm

Strange behavior of function die()

Post by alkz »

I'm developing a PHP application that use MySQL and I wrote a class that contains the methods to access, write and read in the db.
In these methods I use the function die() if something went wrong but I cannot understand why I cannot see the string that I've gave to the function, I only see a white screen.
A more strange fact is that if I don't declare the class and I use the singles functions, the string in die is correctly visualized, I really cannot understand.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Strange behavior of function die()

Post by AbraCadaver »

Most likely you have a parse error in the class and you don't have error reporting setup correctly.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
tr0gd0rr
Forum Contributor
Posts: 305
Joined: Thu May 11, 2006 8:58 pm
Location: Utah, USA

Re: Strange behavior of function die()

Post by tr0gd0rr »

Also keep in mind that `die()` will not accept numbers and that `die()` outputs `null` and `false` as empty strings. You may want to do a `var_dump()` then `die()` so you can differentiate numbers, null, false and empty strings.
Post Reply