need help with php include function
Posted: Fri Aug 22, 2008 1:21 am
I am trying to connect to a mysql database with my php code but I can't make it work if i separate my connection parameter in an include file. However, if I embed my connection parameters in the same page that needs connection to mysql, everything works fine. Here is my php code:
connection.inc.php
login.php
I am getting this error:
Access denied for user 'ODBC'@'localhost' (using password: NO)
Thanks for the help.
Jess
connection.inc.php
Code: Select all
<? php
$username = 'test';
$password = 'test';
$hostname = 'localhost';
$dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL");
?>
Code: Select all
...
<?php
include "connection.inc.php";
?>
...
$result = mysql_query("select * from system.user where username = '$user and password = '$pass' " ) or die(mysql_error());
Access denied for user 'ODBC'@'localhost' (using password: NO)
Thanks for the help.
Jess