Jump to content

Unable to connect to SQL server


bugzy

Recommended Posts

Hello!

 

I have this db_connection.php

 

<?php


$_SESSION['MYSQL_SERVER1'] = "localhost";
$_SESSION['MYSQL_LOGIN1'] = "root";
$_SESSION['MYSQL_PASS1'] = "password";
$_SESSION['MYSQL_DB1'] = "user_registration";

$_SESSION['LOGGEDIN'] = "";
$_SESSION['USERID'] = 0;

$_SESSION['EMAIL'] = "";
$_SESSION['FNAME'] = "";
$_SESSION['LNAME'] = "";

$_SESSION['SESSION'] = true;

?>

 

 

and I'm calling it using this code

 

mysql_connect($_SESSION['MYSQL_SERVER1'],$_SESSION['MYSQL_LOGIN1'],$_SESSION['MYSQL_PASS1'])
or die("Unable to connect to SQL server");
mysql_select_db($_SESSION['MYSQL_DB1']) or die("Unable to select database");

 

 

and it's giving me error

 

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'user1'@'localhost' (using password: YES) in C:\wamp\www\php\user_registration\registered.php on line 84

Unable to connect to SQL server

 

why is it it's pointing to user1'@'localhost ??

 

because I'm using the above connection and it should be "root" right? I have double check everything and tried to use the above connection using different code and it works. I wonder why it isn't working on the 2nd code that I posted...

 

 

btw I'm using mysql from wamp server that is installed on my pc

Link to comment
Share on other sites

  • 1 year later...
Guest
This topic is now 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.