1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Mysql error on PHP page?

Discussion in 'MySQL' started by FanAddict, Apr 9, 2007.

  1. #1
    Hey guys,
    I know absolutely NOTHING about mysql, or the error I am getting, hopefully someone on here knows more then I do! :)


    Here is the line of code it's referring to:

    Iv changed over all URL's to match the new sites URL, along with the .htaccess and config.php file.
     
    FanAddict, Apr 9, 2007 IP
  2. ideas_man

    ideas_man Active Member

    Messages:
    212
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #2
    It sounds like mysql_connect() is missing.There should be a line like the following, somewhere before your mysql_query calls:

    
    mysql_connect("hostname","username","password");
    
    PHP:
    Hope this helps :)
     
    ideas_man, Apr 9, 2007 IP
  3. toby

    toby Notable Member

    Messages:
    6,923
    Likes Received:
    269
    Best Answers:
    0
    Trophy Points:
    285
    #3
    that means you have given a wrong username or password
     
    toby, Apr 9, 2007 IP
    FanAddict likes this.
  4. FanAddict

    FanAddict Notable Member

    Messages:
    7,017
    Likes Received:
    376
    Best Answers:
    0
    Trophy Points:
    230
    #4

    I'm not sure I understand this, lol

    Where would I need to put that?


    This is part of the config.php file:
    ### = my DB info :)

    All information in the config.php is set correctly.
     
    FanAddict, Apr 9, 2007 IP
  5. Pat Gael

    Pat Gael Banned

    Messages:
    1,331
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Maybe your host is not localhost but another mysql server, as in example Netfirms uses mysql.netfirms.com instead.

    By the way, to avoid get errors displaying your site's path (/home/pinkstyl/public_html/wpskins/) put this immediately after <?php

    
    error_reporting(0);
    
    Code (markup):
    this prevents printing any error message, so add it once that your are done fixing the problem
     
    Pat Gael, Apr 9, 2007 IP
    FanAddict likes this.
  6. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #6
    If you are sure the config file has the right user/pass/db name, then the most common error with a manual install on a cPanel server is to forget to append the cPanel username to the db name and user name.

    Example:
    cpanel username george
    db name articles
    db user writer
    pass demo

    Config would look like this:
    dbname george_articles
    dbuser george_writer
    pass demo

    If you did an auto install, just delete the whole mess and do again.
     
    Colbyt, Apr 9, 2007 IP
    FanAddict likes this.
  7. ideas_man

    ideas_man Active Member

    Messages:
    212
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #7
    The only other thing I can think of is if the user you are using does not have the necessary privileges? If it is a new user you have added to mysql, have you given them sufficient privileges to access the database?

    Just a thought :)
     
    ideas_man, Apr 9, 2007 IP
    FanAddict likes this.
  8. FanAddict

    FanAddict Notable Member

    Messages:
    7,017
    Likes Received:
    376
    Best Answers:
    0
    Trophy Points:
    230
    #8
    Hey guys,
    Thanks everyone for the help!

    Problem was: I was not including config.php on all pages... hence the error!

    It's been fixed, and iv repped everyone :)
     
    FanAddict, Apr 9, 2007 IP