Jump to content

[SOLVED] Keep getting ODBC Error


peranha

Recommended Posts


$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

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.

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());

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.