0

I want to select some items from table, but the problem is shown that "Access denied for user 'root'@'localhost' (using password: NO)". The db system cannot select something from table. What can I do?

 <html>
 <body>
 <?php
 include ('opendb.php');
 ......
 echo "Date: " . date("Y/m/d") . "<br>";
$result = mysql_query("SELECT count(semail) AS av FROM `table` ")or die( 
 mysql_error());  
  $row = mysql_fetch_assoc($result) or die("No rows returned by query"); 
echo "Daily Volume: ".$result;
  ...... ?>
halfer
  • 19,824
  • 17
  • 99
  • 186
user3056561
  • 79
  • 1
  • 8

3 Answers3

1

the problem is with your opendb.php file
make sure your database connections credentials are correct.
For some db the default password is root(LAMP environment)

srikanta mondal
  • 119
  • 2
  • 15
0

Probably you do not have any password associated to root so instead of 'NO' left the password equal to '' i.e. empty in your opendb.php !

Moax6629
  • 378
  • 4
  • 14
-1

in opendb.php you might have used mysql_connect() function use like this. This will solve your problem

 $con = mysql_connect("localhost","root","") or die("sorry not connected");
Ankur Dhanuka
  • 1,217
  • 2
  • 11
  • 22