While executing below PHP code I got display "MySQL Connect Error". I am not able to identify my mistake.
Pls help to successfully connect to my MySQL database.
Code: Select all
$c = odbc_connect("root", "pass123", "Driver={MySQL ODBC 5.1 Driver};Server=127.0.0.1;Port=3306;Database=db1; User=root;Password=pass123;Options=3;");
if ($c) {
echo "Successfully connected to MySQL.";
odbc_close($c);
}
else {
echo "MySQL Connect Error ";
}
-------------
OS : Windows XP;
ODBC Driver : MySQL ODBC 5.1 Driver
Web Server : Apache
DB : MySQL.
Note : I am able to connect to the database thru VC++ using CDatabase(it uses same ODBC string)
Regards,
Purusothaman A