in reply to Re: Merge 2 lines in 1 die statement
in thread Die statement with text & formatting of the user

#========== CHECK IF USER EXISTS & OR TRYING TO REGISTER MORE THAN ONC +E ======== local *STDERR = *STDOUT; $! = 0; $select = $db->prepare( "SELECT username, DATE_FORMAT(date, '%d %b, %H +:%i') AS f_date FROM users WHERE username = ?" ); $select->execute( $username ); $row = $select->fetchrow_hashref; die( h1( {class=>'cyan'}, "Μα είσαι + ήδη μέλος $row->{username}! +Πραγματοποί&#9 +51;σες εγγραφή &#96 +3;τις $row->{f_date}." )) if( $select->rows ); $select = $db->prepare( "SELECT username FROM users WHERE host = ?" ); $select->execute( $host ); $row = $select->fetchrow_hashref; die( h1( {class=>'cyan'}, "Κόφτο $row->{usern +ame}! Μην προσπαθ&# +949;ίς να κάνεις &# +960;ολλές εγγρα&#96 +6;ές με διαφορ&#949 +;τικά oνόματα!" )) + if( $select->rows );
I liek the approach you mentioned ikegami, thank you but:

Software error:

Μα είσαι ήδη μέλος marmel13! Πραγματοποίησες εγγραφή στις 25 Apr, 01:16.

at D:\www\cgi-bin\register.pl line 74. For help, please send mail to the webmaster (nikos1337@gmail.com), giving this error message and the time and date of the error. Sat Apr 28 13:05:09 2007 register.pl: Μα είσαι ήδη μέλος marmel13! Πραγματοποίησες εγγραφή στις 25 Apr, 01:16.

Iam getting both the error that i want to print colored which is good but the software error above....

Replies are listed 'Best First'.
Re^3: Merge 2 lines in 1 die statement
by rhesa (Vicar) on Apr 28, 2007 at 13:35 UTC
    die not only exits your program, it also sets a non-zero return code. Your webserver sees that, and concludes there was an error in your program.

    Either use ikegami's hint of setting $!=0, or do the sensible thing and use exit.