Php 5 and mysql connecting gives error ...code and error in there check out and plz..plz help....
Posted
by user309381
on Stack Overflow
See other posts from Stack Overflow
or by user309381
Published on 2010-04-16T11:31:43Z
Indexed on
2010/04/16
11:33 UTC
Read the original article
Hit count: 283
**mysql_query() [function.mysql-query]: Access denied for user 'SYSTEM'@'localhost' (using password: NO) in C:\wamp\www\photo_gallery\includes\database.php on line 56
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\photo_gallery\includes\database.php on line 56
The Query has problemAccess denied for user 'SYSTEM'@'localhost' (using password: NO) i have set the password for root and grant privilege all for root.Why it soes show like SYSTEM@localhost i dont have SYSTEM .**
class MySQLDatabase { public $connection; function _construct() { $this->open_connection(); } public function open_connection() { /* $DB_SERVER = "localhost"; $DB_USER = "root"; $DB_PASS = ""; $DB_NAME = "photo_gallery";*/ $this->connection = mysql_connect($DBSERVER,$DBUSER,$DBPASS); if(!$this->connection) { die("Database Connection Failed" . mysql_error()); } else { $db_select = mysql_select_db($DBNAME,$this->connection); if(!$db_select) { die("Database Selection Failed" . mysql_error()); } } } function mysql_prep($value) { if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not a number if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value;
}
public function close_connection()
{
if(isset($this->connection))
{
mysql_close($this->connection);
unset($this->connection);
}
}
public function query($sql)
{
//$sql = "SELECT*FROM users where id = 1";
$result = mysql_query($sql);
$this->confirm_query($result);
//$found_user = mysql_fetch_assoc($result);
//echo $found_user;
return $found_user;
}
private function confirm_query($result)
{
if(!$result)
{
die("The Query has problem" . mysql_error());
}
}
}
$database = new MySQLDatabase();
?>
© Stack Overflow or respective owner