Help my database does not connect blank page and without showing error message

In my website I design a web application that when connecting to the database does not show the interface and does not show an error (blank page),

  • database created
  • connection ok
  • PHP language

Error Message

(Blank page)


<?php $link = ';dbname=epiz_27237784_fase2'; $user = "epiz_27237784"; $pass = "******"; try{ $pdo = new PDO($link,$user,$pass); }catch(PDOException $e){ die('No pudo conectarse: ' . mysql_error()); } ?>

If f you check out console, you’ll notice there’s error .no 500 in console:


I have beautified the code for you:

<?php $link = ';dbname=epiz_27237784_fase2';
$user = "epiz_27237784";
$pass = "******";
    $pdo = new PDO($link, $user, $pass);
catch(PDOException $e)
    die('No pudo conectarse: ' . mysql_error());
} ?>

Here is the error I got using my debugger:

Fatal error : Uncaught Error: Call to undefined function mysql_error() in […][…]:10
Stack trace:
#0 {main}
thrown in […][…] on line 10

Here’s another version of it which might work in PDO

// Change this to your connection info.
$DATABASE_HOST = 'localhost';
$DATABASE_USER = 'root';
$DATABASE_NAME = 'phplogin';
// Try and connect using the info above.
if ( mysqli_connect_errno() ) {
	// If there is an error with the connection, stop the script and display the error.
	exit('Failed to connect to MySQL: ' . mysqli_connect_error());
// Now we check if the data from the login form was submitted, isset() will check if the data exists.
if ( !isset($_POST['username'], $_POST['password']) ) {
	// Could not get the data that should have been sent.
	exit('Please fill both the username and password fields!');
// Prepare our SQL, preparing the SQL statement will prevent SQL injection.
if ($stmt = $con->prepare('SELECT id, password FROM accounts WHERE username = ?')) {
	// Bind parameters (s = string, i = int, b = blob, etc), in our case the username is a string so we use "s"
	$stmt->bind_param('s', $_POST['username']);
	// Store the result so we can check if the account exists in the database.
if ($stmt->num_rows > 0) {
	$stmt->bind_result($id, $password);
	// Account exists, now we verify the password.
	// Note: remember to use password_hash in your registration file to store the hashed passwords.
	if (password_verify($_POST['password'], $password)) {
		// Verification success! User has loggedin!
		// Create sessions so we know the user is logged in, they basically act like cookies but remember the data on the server.
		$_SESSION['loggedin'] = TRUE;
		$_SESSION['name'] = $_POST['username'];
		$_SESSION['id'] = $id;
		echo 'Welcome ' . $_SESSION['name'] . '!';
	} else {
		// Incorrect password
		echo 'Incorrect username and/or password!';
} else {
	// Incorrect username
	echo 'Incorrect username and/or password!';


That’s a problem in this line:

die('No pudo conectarse: ' . mysql_error());

That’s the function used to get errors in the old mysql library, but you’re using PDO instead. Instead, this code should probably be:

die('No pudo conectarse: ' . $e->getMessage());

implement your code, and I get this error

Failed to connect to MySQL: Access denied for user ‘epiz_27237784’@‘192.168.%’ to database ‘epiz_27237784_fase2’

make the changes and I still have a blank page and no error message


I’m sure I’m using the right database credentials

It already explains well, it looks you’re either using your account password instead of password of account of your site or your password permissions are corrupted:

1 Like
  • The .htaccess file contains invalid rules.

I have some error in my .htaccess
this is my code

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

There is a problem with connecting your database. Fill in the details in the correct order:
Database Name

Is the statement present?


They aren’t required, it just activates the code if rewrite is enabled. Off which it is. It’s good for use in software development so if users don’t have mod_rewrite installed it gives an error.


This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.