mercredi 15 juin 2016

mysql_connect working while mysqli_connect not

I know this question has been asked a few times here but still i wasn't able to find any answer that would actually help me.

Since i read in documentation that mysql_connect is now deprecated i wanted to replace it with mysqli_connect.
Original script looked like this:

mysql_connect($host, $user, $pswd);
mysql_select_db($db);

This script was functional and could successfully connect to MySQL. I replaced it with:

mysqli_connect($host, $user, $pswd, $db);

(no changes in variables or any other lines of code)

Althought it should work according to documentation and like every tutorial i read, it gives me access denied error. Most problems i saw answered were just typos or worng variables, which is not this case.

Since i am going to keep this project procedural and i am pretty sure i have enough to learn before i'll start with PDO's which is solution provided in the rest of answers i found i am quite desperate.

So where is the problem?

PS: This is my first question here, i really tried to ask properly, but if i did something wrong please be kind and just tell me what i did wrong and how should i do it next time :)

Aucun commentaire:

Enregistrer un commentaire