Help with mysqli log in

Hi
We have a section on our website where B2B customers can log in. Recently this stopped functioning (I think it may be when we changed to a cloud server from a vps - but I am not sure)
When we try to log in, this is the result:

Warning: mysqli::mysqli() [mysqli.mysqli]: (28000/1045): Access denied for user ‘CarSearch’@‘localhost’ (using password: YES) in /home/coversyscouk/public_html/business/inc/_users.php on line 42

Warning: mysqli_real_escape_string() [function.mysqli-real-escape-string]: Couldn’t fetch mysqli in /home/coversyscouk/public_html/business/inc/_users.php on line 83

Warning: mysqli::query() [mysqli.query]: Couldn’t fetch mysqli in /home/coversyscouk/public_html/business/inc/_users.php on line 85

Fatal error: Call to a member function fetch_row() on a non-object in /home/coversyscouk/public_html/business/inc/_users.php on line 86

The following is the programming in our _users.php:

Firstly lines 40, 41, 42, 43

[code]//Login to SQL
public function doSQL($table) {
	$sql = new mysqli("localhost", "CarSearch", ".m4bBXaUus6E4K3a", $table);
	return $sql;
}[/code]

Secondly lines 81 to 86

//Check if the email address exists $checkUserEmail = sprintf("SELECT email, password FROM users WHERE email = '%s' LIMIT 1", mysqli_real_escape_string($sql,$login_email) ); $result = $sql->query($checkUserEmail); $row = $result->fetch_row();

Any help would be much appreciated!
Thank you
Daren

Prepared statements. mysqli_real_escape_string() is not needed when you use the correct query type.

I would check the cloud host’s connection string, it is quite likely that it is no longer on the same server.

Sponsor our Newsletter | Privacy Policy | Terms of Service