June 21, 201115 yr I’m building a social network website and I was doing so well until now. ALL my connections are good. I’ve got my script in the proper file / location. This is my error response… Warning: mysql_query() [function.mysql-query]: Access denied for user 'mywebsite'@'localhost' (using password: NO) in /home/mywebsite/public_html/root/scripts/homePage_randomMembers.php on line 6 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/mywebsite/public_html/root/scripts/homePage_randomMembers.php on line 6 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mywebsite/public_html/root/scripts/homePage_randomMembers.php on line 7 This is my script… <?php $MemberDisplayList = '<table border="0" align="center" cellpadding="6"> <tr> '; // Mysql connection is already made in the file this one gets included into // So we can run queries here without having to connect again $sql = mysql_query("SELECT id, username, firstname FROM myMembers WHERE email_activated='1' ORDER BY RAND() LIMIT 6"); while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $username = $row["username"]; $firstname = $row["firstname"]; if (!$firstname) { $firstname = $username; } $firstnameCut = substr($firstname, 0, 10); $check_pic = "members/$id/image01.jpg"; if (file_exists($check_pic)) { $user_pic = "<img src=\"members/$id/image01.jpg\" width=\"64px\" border=\"0\" />"; } else { $user_pic = "<img src=\"members/0/image01.jpg\" width=\"64px\" border=\"0\" />"; } $MemberDisplayList .= '<td><a href="res.php?id=' . $id . '" title="' . $firstname . '"><font size="-2">' . $firstnameCut . '</font></a><br /> <div style=" height:64px; overflow:hidden;"><a href="res.php?id=' . $id . '" title="' . $firstname . '">' . $user_pic . '</a></div></td>'; } // close while loop $MemberDisplayList .= ' </tr> </table> '; ?> Please Help! Thanks in advance, Scotty13
June 21, 201115 yr As the error says, you've not got permission to access the table with the credentials given. Does your user have a password? if so, it's not been set
June 21, 201115 yr I presume you have missed off the include('../path/to/database/file.php'); since there is no connection set to the database.
Create an account or sign in to comment