Discussion:
php code review and help
PIYUSH DAS
2014-02-24 18:16:02 UTC
Permalink
Kindly consider the following code

function dbOpen()
{
$this->_dbCon=mysql_connect($this->_dbhostName,$this->_dbUser,$this->_dbPwd)
or die ("Could not connect DB");
mysql_select_db($this->_dbName,$this->_dbCon) or die ("Could not select
DatabaseClass");
}

i am getting an error
Warning: mysql_connect() [<a
href='function.mysql-connect'>function.mysql-connect</a>]: Access denied
for user 'Piyush'@'localhost' (using password: YES) in
C:\wamp\www\lib\db.php on line*897*Call Stack
--
PIYUSH DAS
LUCKNOW
9648916741/9208275121
Jonathan Sundquist
2014-02-24 18:17:40 UTC
Permalink
Post by PIYUSH DAS
Kindly consider the following code
function dbOpen()
{
$this->_dbCon=mysql_connect($this->_dbhostName,$this->_dbUser,$this->_dbPwd)
or die ("Could not connect DB");
mysql_select_db($this->_dbName,$this->_dbCon) or die ("Could not select
DatabaseClass");
}
i am getting an error
Warning: mysql_connect() [<a
href='function.mysql-connect'>function.mysql-connect</a>]: Access denied
C:\wamp\www\lib\db.php on line*897*Call Stack
--
PIYUSH DAS
LUCKNOW
9648916741/9208275121
Typically means you have entered the wrong password. Verify your username,
hostname, and password then try again.
Aziz Saleh
2014-02-24 18:19:25 UTC
Permalink
Post by PIYUSH DAS
Kindly consider the following code
function dbOpen()
{
$this->_dbCon=mysql_connect($this->_dbhostName,$this->_dbUser,$this->_dbPwd)
or die ("Could not connect DB");
mysql_select_db($this->_dbName,$this->_dbCon) or die ("Could not select
DatabaseClass");
}
i am getting an error
Warning: mysql_connect() [<a
href='function.mysql-connect'>function.mysql-connect</a>]: Access denied
C:\wamp\www\lib\db.php on line*897*Call Stack
--
PIYUSH DAS
LUCKNOW
9648916741/9208275121
The password is incorrect.Insure that the password variable $this->_dbPwd
is correct.

Also if this is something new you are coding, I would advise you use PDO or
MySQLI instead.

Aziz
Aziz Saleh
2014-02-24 19:06:02 UTC
Permalink
sir,
i am still facing the problem, i am at a very early learning stage and am
not able to understand properly, I am sending you the file as attachment
kindly see and help if possible.
Post by Aziz Saleh
Post by PIYUSH DAS
Kindly consider the following code
function dbOpen()
{
$this->_dbCon=mysql_connect($this->_dbhostName,$this->_dbUser,$this->_dbPwd)
or die ("Could not connect DB");
mysql_select_db($this->_dbName,$this->_dbCon) or die ("Could not select
DatabaseClass");
}
i am getting an error
Warning: mysql_connect() [<a
href='function.mysql-connect'>function.mysql-connect</a>]: Access denied
C:\wamp\www\lib\db.php on line*897*Call Stack
--
PIYUSH DAS
LUCKNOW
9648916741/9208275121
The password is incorrect.Insure that the password variable $this->_dbPwd
is correct.
Also if this is something new you are coding, I would advise you use PDO
or MySQLI instead.
Aziz
--
PIYUSH DAS
LUCKNOW
9648916741/9208275121
Please keep all emails towards the mailing list and never send out your
mysql credentials to the public.

Are you sure that the username and password you have are correct? Can you
try the username and password on PHPMyAdmin (or any other db management
software you are using) and see if that works.

Aziz
Aziz Saleh
2014-02-24 19:16:03 UTC
Permalink
username and password used are correct to my knowledge the initial
developer told me that the file as attached needs to be edited. the error
as shown is Warning: mysqli_connect() [<a
C:\wamp\www\lib\db.php on line *897*
Post by Aziz Saleh
sir,
i am still facing the problem, i am at a very early learning stage and
am not able to understand properly, I am sending you the file as attachment
kindly see and help if possible.
Post by Aziz Saleh
Post by PIYUSH DAS
Kindly consider the following code
function dbOpen()
{
$this->_dbCon=mysql_connect($this->_dbhostName,$this->_dbUser,$this->_dbPwd)
or die ("Could not connect DB");
mysql_select_db($this->_dbName,$this->_dbCon) or die ("Could not select
DatabaseClass");
}
i am getting an error
Warning: mysql_connect() [<a
href='function.mysql-connect'>function.mysql-connect</a>]: Access denied
C:\wamp\www\lib\db.php on line*897*Call Stack
--
PIYUSH DAS
LUCKNOW
9648916741/9208275121
The password is incorrect.Insure that the password variable
$this->_dbPwd is correct.
Also if this is something new you are coding, I would advise you use
PDO or MySQLI instead.
Aziz
--
PIYUSH DAS
LUCKNOW
9648916741/9208275121
Please keep all emails towards the mailing list and never send out your
mysql credentials to the public.
Are you sure that the username and password you have are correct? Can you
try the username and password on PHPMyAdmin (or any other db management
software you are using) and see if that works.
Aziz
--
PIYUSH DAS
LUCKNOW
9648916741/9208275121
Sorry not seeing the issue here that the developer is talking about. Why
not have that developer tell you what needs to be modified?
Aziz Saleh
2014-02-24 19:26:19 UTC
Permalink
SIR, THIS IS A DOWNLOADED VERSION FROM A WEBSITE AND MESSAGE IS AT STATED
IN THE WEBSITE
Post by Aziz Saleh
username and password used are correct to my knowledge the initial
developer told me that the file as attached needs to be edited. the error
as shown is Warning: mysqli_connect() [<a
C:\wamp\www\lib\db.php on line *897*
Post by Aziz Saleh
sir,
i am still facing the problem, i am at a very early learning stage
and am not able to understand properly, I am sending you the file as
attachment kindly see and help if possible.
Post by Aziz Saleh
Post by PIYUSH DAS
Kindly consider the following code
function dbOpen()
{
$this->_dbCon=mysql_connect($this->_dbhostName,$this->_dbUser,$this->_dbPwd)
or die ("Could not connect DB");
mysql_select_db($this->_dbName,$this->_dbCon) or die ("Could not select
DatabaseClass");
}
i am getting an error
Warning: mysql_connect() [<a
href='function.mysql-connect'>function.mysql-connect</a>]: Access denied
C:\wamp\www\lib\db.php on line*897*Call Stack
--
PIYUSH DAS
LUCKNOW
9648916741/9208275121
The password is incorrect.Insure that the password variable
$this->_dbPwd is correct.
Also if this is something new you are coding, I would advise you use
PDO or MySQLI instead.
Aziz
--
PIYUSH DAS
LUCKNOW
9648916741/9208275121
Please keep all emails towards the mailing list and never send out your
mysql credentials to the public.
Are you sure that the username and password you have are correct? Can
you try the username and password on PHPMyAdmin (or any other db management
software you are using) and see if that works.
Aziz
--
PIYUSH DAS
LUCKNOW
9648916741/9208275121
Sorry not seeing the issue here that the developer is talking about. Why
not have that developer tell you what needs to be modified?
--
PIYUSH DAS
LUCKNOW
9648916741/9208275121
Try changing localhost to 127.0.0.1 and see if that helps.

If the username and password in that file are correct, it could be a server
issue. Contact your host to see if they can figure it out. Could be
permission issues.

*Please click on reply-all when replying to the emails.*

Aziz
haiwen zhu
2014-02-25 02:27:15 UTC
Permalink
Post by PIYUSH DAS
Kindly consider the following code
function dbOpen()
{
$this->_dbCon=mysql_connect($this->_dbhostName,$this->_dbUser,$this->_dbPwd)
or die ("Could not connect DB");
mysql_select_db($this->_dbName,$this->_dbCon) or die ("Could not select
DatabaseClass");
}
i am getting an error
Warning: mysql_connect() [<a
href='function.mysql-connect'>function.mysql-connect</a>]: Access denied
C:\wamp\www\lib\db.php on line*897*Call Stack
--
PIYUSH DAS
LUCKNOW
9648916741/9208275121
type "show grants for 'Piyush'@'localhost' " and make sure you have the
privilege to access your database
--
Best Regards,
HaiwenZhu
George Wilson
2014-02-25 17:21:11 UTC
Permalink
Post by haiwen zhu
Post by PIYUSH DAS
i am getting an error
Warning: mysql_connect() [<a
href='function.mysql-connect'>function.mysql-connect</a>]: Access denied
C:\wamp\www\lib\db.php on line*897*Call Stack
--
PIYUSH DAS
LUCKNOW
9648916741/9208275121
privilege to access your database
--
Best Regards,
HaiwenZhu
You might also check with your developer and/or DBA and verify which
host/network domain you are supposed to be running this script from. Piyush
may be the correct user name and your password may be correct, but
authenticating from localhost could be a problem if your user credentials
are say (for example) ***@server1 or something like that. This could
occur if you are developing locally but the script is meant to be run on a
production or development server for instance.

Continue reading on narkive:
Loading...