Simple connection to DB problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sleepwalker0
Forum Newbie
Posts: 17
Joined: Sun Feb 19, 2006 4:13 pm

Simple connection to DB problem

Post by sleepwalker0 »

I get this error

Code: Select all

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: YES) in C:\wamp\www\learning php\db_connect.php on line 12
Access denied for user 'ODBC'@'localhost' (using password: NO
My PHP MyAdmin setting to root was


Code: Select all

[b]
User   Host          Password    Global privileges   Grant [/b]
root    localhost   No               ALL PRIVILEGES    Yes
and finally my code is

Code: Select all

<?php

//connect
$username = "root";
$password = "";
$connect = mysql_connect('localhost',$usermame,$password)
or die (mysql_error());
echo 'Connection Established';

// database select
$database = 'videocrate';
mysql_select_db($database) or die (mysql_error());
echo 'database chosen';

?>
Any ideas why?

PS what is ODBC, I didnt include it in my code...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

look very closely at your variables names.

This is why I always recommend programming with E_ALL set for error reporting.
sleepwalker0
Forum Newbie
Posts: 17
Joined: Sun Feb 19, 2006 4:13 pm

Post by sleepwalker0 »

It works now! Thanks your my php jesus :lol:
Post Reply