user1715245
user1715245

Reputation:

PHP script dies after each error

Im trying to make my script output the error on screen but the error keeps outputting into error_log and killing the script,

This is my current code

        try{
            $db->query("SELECT `test`.`test` FROM `test` WHERE `test`.`test` = test");
            echo("no work?");
        }catch(PDOException $er){
            print("Still dont work");
        }

$db->query... returns a error like it should but the script dies there, outputs into the error_log and wont finish it like i would like it to.

Can anyone help?

Just to sum up some of the responses i got, it is not the actual die() function that is killing the script, it's the error it's self at $db->query().

Upvotes: 1

Views: 92

Answers (1)

user149341
user149341

Reputation:

As the name would suggest, die() makes your script die (i.e, exit) after printing the message you pass it.

If you just want it to print the error, use print() instead of die().

Upvotes: 3

Related Questions