Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End PHP Error Warning

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #28667
    MichaelR
    Member

    Hi, I’m having some trouble with a script I’m making I see this error:

    Warning: mysql_query() [function.mysql-query]: Access denied for user ‘rettro’@’localhost’ (using password: NO) in /home/rettro/public_html/admin/post.php on line 52

    Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/rettro/public_html/admin/post.php on line 52

    I’ll show you the page If that helps?

    Code:


    ” . $sql . “
    ” . mysql_error());

    while($row = mysql_fetch_array($result)) {

    $date = date(“l F d Y”, $row[‘timestamp’]);

    $title = stripslashes($row[‘title’]);
    $entry = stripslashes($row[‘entry’]);
    $password = $row[‘password’];
    $get_categories = mysql_query(“SELECT * FROM php_blog_categories WHERE `category_id` = $row[category]”);
    $category = mysql_fetch_array($get_categories);

    if ($password == 1) {
    if (isset($_POST[‘username’]) && $_POST[‘username’] == $my_username) {
    if (isset($_POST[‘pass’]) && $_POST[‘pass’] == $my_password) {
    ?>

    “>

    Sorry, wrong password.

    ‘ . $title . ‘

    ‘;

    printf(“

    This is a password protected blog post. If you have a password for the post, enter it below.

    “);

    printf(“



    “,$id);
    print “

    “;
    }
    }
    else { ?>

    “>

    ” . $sql . “
    ” . mysql_error());
    while($row = mysql_fetch_array($result)) {
    $timestamp = date(“l F d Y”, $row[‘timestamp’]);
    printf(‘

    ‘);
    printf(“

    %s. On %s

    “, stripslashes($row[‘url’]), stripslashes($row[‘name’]), $timestamp);
    print(“

    ” . stripslashes($row[‘comment’]) . “

    “);
    printf(“

    “);
    }

    ?>

    Name:




    ” . $sql_prev . “
    ” . mysql_error());

    while ($row = mysql_fetch_array($result_prev)) {
    $prev = $row[‘id’];
    }

    if (isset($prev)) {
    // print a previous link
    printf(“Previous “, $prev);
    }
    else {
    // just print the word “previous”

    print “Previous “; ?> |

    ‘$id’ ORDER BY id LIMIT 1″;
    $result_next = mysql_query ($sql_next) or print (“Can’t select next entry id table php_blog.
    ” . $sql_next . “
    ” . mysql_error());

    while ($row = mysql_fetch_array($result_next)) {
    $next = $row[‘id’];
    }

    if (isset($next)) {
    // print a next link
    printf(“ Next“, $next);
    }
    else {
    // just print the word “next”

    print ” Next”;
    }
    } ?>

    I’m really unsure on what do do, Michael. :roll:

#73852
cybershot
Participant

I don’t know for sure. Is it possible that you don’t have permissions set up on the database for that user? does retro have full read, write access

#73907

As cybershot said above, a "Access denied for user" error usually indicates either incorrect permissions or an incorrect database username or password. I’d double check your database login details and make sure they are correct.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.