Hi every one
I am new to php and trying to connect PHP and MySQL
my code is as below

<html>
<body>
<?php
$My_con= mysql_connect('localhost');
echo $My_con
 ?>
</body>
</html>

but this error occurd

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\Program Files\EasyPHP 3.0\www\samplephp\statsql.php on line 4
thnx in advance

Hi,
you are not using all the arguments of the function mysql_connect(), try the following code. If this helped you, do add
it to my reputation. Thanks

$con = mysql_connect("localhost");   
      if (!$con)     
         die('Could not connect: ' . mysql_error());    
      else   
         echo "connected";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.