PHP error -
Iverso - 25.12.2015
Warning: mysql_connect(): Access denied for user 'charlesp'@'localhost' (using password: YES) in /home/firstga1/public_html/global/class/SQL.php on line 30
Could not connect: Access denied for user 'charlesp'@'localhost' (using password: YES)
<?php
/*$host="localhost";
$username="cp";
$password="chuJUstabR2XA3";
$host="ns2.kloud51.com";
$username="ngrp";
$password="@phh63oo3";
$db_name="NGRP";*/
/* Windows Box
DEFINE('HOST', 'eu9.hostskool.com');
DEFINE('USRNM', 'charlesp');
DEFINE('PSWD', '****');
DEFINE('DBNM', 'charlesp');
*/
// Linux Box
DEFINE('HOST', 'eu9.hostskool.com');
DEFINE('USRNM', 'charlesp');
DEFINE('PSWD', '*****');
DEFINE('DBNM', 'charlesp');
/*
DEFINE('HOST', 'eu9.hostskool.com');
DEFINE('USRNM', 'charlesp');
DEFINE('PSWD', '*****');
DEFINE('DBNM', 'charlesp');
*/
mysql_connect("127.0.0.1", "charlesp", "******") or die('Could not connect: ' . mysql_error());
mysql_select_db("charlesp") or die('Could not connect: ' . mysql_error());
?>
Re: PHP error -
FreAkeD - 25.12.2015
You have to make sure you are using the correct MYSQL details.
Re: PHP error -
JasperM - 25.12.2015
The script looks fine, except from this piece on top "?php" which should obviously be "<?php".
Furthermore, MySQL_* is deprecated and shouldn't be used anymore, I recommend you to use PDO or MySQLi. MySQL can't be used anymore from PHP 6.0 I believe, meaning your scripts won't run when this version becomes the standard. MySQLi has an excellent way of procedural programming, just like MySQL has, but I personally recommend PDO because it supports more database engines and in my opinion it's better overall.
Re: PHP error -
Iverso - 26.12.2015
Quote:
Originally Posted by JasperM
The script looks fine, except from this piece on top "?php" which should obviously be "<?php".
Furthermore, MySQL_* is deprecated and shouldn't be used anymore, I recommend you to use PDO or MySQLi. MySQL can't be used anymore from PHP 6.0 I believe, meaning your scripts won't run when this version becomes the standard. MySQLi has an excellent way of procedural programming, just like MySQL has, but I personally recommend PDO because it supports more database engines and in my opinion it's better overall.
|
i conver it to pdo new error :
SQLSTATE[HY000] [2002] Connection timed outSELECT `id`, `Username`, `IP`, `SecureIP`, `AdminLevel`, `Helper`, `ReferredBy` FROM `accounts` WHERE `Username` = ''Invalid query: Access denied for user ''@'localhost' (using password: NO)
Re: PHP error -
SaltySandy - 26.12.2015
Your credentials are wrong. Make sure you use the correct details when you make the code.
Re: PHP error -
Iverso - 26.12.2015
Quote:
Originally Posted by SaltySandy
Your credentials are wrong. Make sure you use the correct details when you make the code.
|
Код:
$admquery = "SELECT `id`, `Username`, `IP`, `SecureIP`, `AdminLevel`, `Helper`, `ReferredBy` FROM `accounts` WHERE `Username` = '$myusername'";
$admincheckquery = mysql_query($admquery);
if (!$admincheckquery) {
echo $admquery;
die('Invalid query: ' . mysql_error());
Re: PHP error -
SaltySandy - 26.12.2015
Fill in the details of your connection correctly. They are wrong.
Re: PHP error -
J4Rr3x - 27.12.2015
Quote:
SQLSTATE[HY000] [2002] Connection timed outSELECT `id`, `Username`, `IP`, `SecureIP`, `AdminLevel`, `Helper`, `ReferredBy` FROM `accounts` WHERE `Username` = ''Invalid query: Access denied for user ''@'localhost' (using password: NO)
|
Your database haven't a password.
Then, in the connection string leave password parameter as blank.