Problem linkin mySQL Database


#1

I’m here because my php/sql setup doesn’t work. I have my home page for my site which is “index.php” with a formular on it. This formular is to log into my site. It heads to “connex.php” with a “POST” method.
Here is the code of “connex.php”

<?php
//var_dump($_POST);die;
$user = $_POST['username'];
$pass = $_POST['password'];

if(isset($user) && isset($pass)){
	if(connect($user,$pass)){
		session_start();
		$_SESSION['user'] = $user;
		header('Location: ../index.php');
	}
	else{
		$erreur = true;
		header('Location: ../index.php');
	}
}

function connect($user,$pass){
	try
	{
		$bdd = new PDO('mysql:host=127.0.0.1;dbname=c9', 'remsdevoiron', '');
		$req = $bdd->prepare('SELECT count(*) FROM users WHERE Login = ? AND Password = ?');
		$req->execute(array($user, $pass));
		return ((int)$req->fetch() > 0);
	}
	catch (Exception $e)
	{
	        die('Erreur : ' . $e->getMessage());
	}
}
?>

The problem comes from this line :
$bdd = new PDO('mysql:host=127.0.0.1;dbname=c9', 'remsdevoiron', '');

When I connect with pseudo/password couples which are in my database, it works, but it works with any pseudo/password couple. I think it’s because the database isn’t linked. I’ve tryed a lot of stuff but anything worked.
No error message is displayed.
And it’s very urgent, the deadline of this project is tomorrow.
I you know where the issue comes from, it would be so nice.

Thanks