peranha Posted April 1, 2008 Share Posted April 1, 2008 $server = 'localhost'; $user = 'usercon'; $pass = 'P@ssW@rd1436'; $db = 'testgmdb'; // connect to the mysql server $link = mysql_connect($server, $user , $pass) or die ("Could not connect to mysql because ".mysql_error()); // select the database mysql_select_db($db) or die ("Could not select database because ".mysql_error()); That code keeps getting me Access denied for user 'ODBC'@'localhost' (using password: NO) Not sure why, it is in a new folder testgmdb, but works fine in other files all over the website, no matter what folders they are in. Any suggestions. Link to comment https://forums.phpfreaks.com/topic/98930-solved-keep-getting-odbc-error/ Share on other sites More sharing options...
coder_ Posted April 1, 2008 Share Posted April 1, 2008 did you create a user in mysql server. seems like you didn't. Link to comment https://forums.phpfreaks.com/topic/98930-solved-keep-getting-odbc-error/#findComment-506181 Share on other sites More sharing options...
peranha Posted April 1, 2008 Author Share Posted April 1, 2008 yes, it is the same that I am using all over the website, the only thing different that the rest is I added it in a new folder. does not work here htdocs/testgmdb works in all of theses, and subfolders. htdocs/ htdocs/admin htdocs/forum Not sure why this is though. Link to comment https://forums.phpfreaks.com/topic/98930-solved-keep-getting-odbc-error/#findComment-506182 Share on other sites More sharing options...
discomatt Posted April 1, 2008 Share Posted April 1, 2008 No, that's an odd error... Access denied for user 'ODBC'@'localhost' (using password: NO) Is like calling mysql_connect() with no arguments Try this: $server = 'localhost'; $user = 'usercon'; $pass = 'P@ssW@rd1436'; $db = 'testgmdb'; // Test echo echo "$server, $user, $pass"; // connect to the mysql server $link = mysql_connect($server, $user , $pass) or die ("Could not connect to mysql because ".mysql_error()); // select the database mysql_select_db($db) or die ("Could not select database because ".mysql_error()); Link to comment https://forums.phpfreaks.com/topic/98930-solved-keep-getting-odbc-error/#findComment-506194 Share on other sites More sharing options...
peranha Posted April 1, 2008 Author Share Posted April 1, 2008 When I echo I get nothing on the screen. not sure why that is. Any ideas. Link to comment https://forums.phpfreaks.com/topic/98930-solved-keep-getting-odbc-error/#findComment-506931 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.