Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.


Results 1 to 6 of 6

Thread: PHP connect problem

  1. #1

    PHP connect problem

    I will appreciate it EXtreamly if someone can help me asap, please. Created a database, ashtonnews, with table tblsubscribe. On my page where the database should list the entries, it doesn't show. Give's me a msg :

    Warning: mysql_connect(): Access denied for user: 'news@localhost' (Using password: YES) in c:\inetpub\wwwroot\ashton\db_connect.php on line 3

    Here's my db_connect.php

    PHP Code:
    //open connection
    $conn mysql_connect("localhost""news""news");

    //Pick the database to use
    I HAVE granted uname etc and flush priviliges...

    Here's my script for that page, calling entries from db and (suppose to) display them :

    PHP Code:
    $sql "Select * from tblsubscribe";
    //Create recordset called $rssub
    $rssub mysql_query($sql,$conn);
    //Find out how many records in the recordset
    $rows mysql_fetch_assoc($rssub); 
    PHP Code:
      do { 
            <td align="left"><?php echo $rows['sid']; ?></td>
            <td align="left"><?php echo $rows['sname']; ?></td>
            <td align="left"><?php echo $rows['semail']; ?></td>
            <td align="left"><?php echo $rows['sdate']; ?></td>
             } while ($rows = mysql_fetch_assoc($rssub)) ;
    this is EXACTLY what I've always done (I've actually copied and pasted everything..

    PLEAAAASE help me! I just don't know what to do??!

  2. #2
    Backend Specialist
    That's an access error to the database. You need to make sure the user was created with all the rights that you need. Verify by putting your root username and password in there and seeing if it connects properly. If it does, you know there's a problem with that user you created. Triple check it, then delete it and bring up mysql.com documentation if that doesn't work to verify you did it right.

  3. #3
    Got the same thing today. I think it's youre password that's invalid. I tried this also first ai had a short password and i got the same message. Then i changed it to a longer one with numbers in it and it worked fine. So maybe it helps you too...

  4. #4
    thanks, but i contacted the hosting company, and they said my db_connect was wrong. I used their IP address, instead of localhost...

  5. #5
    so is it correct now or no?

    if not, you might want to make sure that the host isn't changing your db name. for instance, my host changes my db names to "[username]_[dbname]" format.

  6. #6
    Quote Originally Posted by bwh2 View Post
    so is it correct now or no?

    if not, you might want to make sure that the host isn't changing your db name. for instance, my host changes my db names to "[username]_[dbname]" format.
    Gawd, i hate my host for that.

    member #1 of the "XML-is-a-crutch-to-make-people-feel-elite-club"
    K-Emmys-06: Best Quote K-Emmys-06: Flash Genious

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About kirupa.com Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012