[Question Moved] Syntax Query (Question from chemngng)

Advisor Edit: Question moved from stand-alone Visitor Message to appropriate forum

I am just wondering what I have done wrong. I successfully installed Netbeans, PHP, MySQL, APACHE on Ubuntu 11.04 and I have been developing applications with them. Recently, Whenever I try to establish a connection with a MySQL using the following lines of code, and run the page from Netbeans, i get a blank page…ie not even the “die” statement runs on the browser and the entire page becomes blank. Whenever, I comment out these lines, the page runs normally… I just wondering what crime I have committed…

$conn = mysql_connect("localhost", "user", "password")
        or die ("Unable to connect to the server due to an error: " .  mysql_error());
        
if($conn){
    echo "Connection established with mysql server";
    $db = mysql_select_db($database_name)
        or die ("There were some problems while choosing database: ".  mysql_error());
}

Please I need help becos I have been stuck for the past two days just because of this.

Make sure error reporting is on full whack and error logging is on. Check the error log.

I am in the same boat. I remember a time when the browser you are using would display the error and you didn’t have to go to the log to find it. How do you turn this function on, instead of the browser displaying a blank page?

Found answer with htaccess:


php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on