Guys i'm having common issue.
I want to display data from MySQL database into HTML page using PHP.
Using this code:
Pulse Sensor Data
$servername = 'localhost';
$username = 'root';
$password = '';
// Connect to database server
mysql_connect('192.168.1.106','root','','database') or die (mysql_error ());
// Select database
mysql_select_db('database') or die(mysql_error());
// SQL query
$strSQL = "SELECT * FROM pulsesensor";
// Execute the query (the recordset $rs contains the result)
$rs = mysql_query($strSQL);
// Loop the recordset $rs
while($row = mysql_fetch_array($rs)) {
// Write the value of the column id and value
echo $row['id'] . " " . $row['value'] . "
";
}
// Close the database connection
mysql_close();
?>
but i got
mysql_connect(): Access denied for user 'root'@'XXX' (using password: NO) in C:\xampp\htdocs\html.php on line 16
Access denied for user 'root'@'Dell' (using password: NO)
i changed the password the same error appear
mysql_connect(): Access denied for user 'root'@'XXX' (using password: YES) in C:\xampp\htdocs\html.php on line 16
Access denied for user 'root'@'Dell' (using password: YES)
i don't know what to do
No comments:
Post a Comment