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.

database error?

Discussion in 'Databases' started by DK-Tandy, Oct 14, 2010.

  1. #1
    "; }}}} if(isset($_SESSION['username']) && isset($_SESSION['password'])){ header("Location: members.php"); } ?>
    Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in F:\xampp\htdocs\includes.php on line 2
    
    Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in F:\xampp\htdocs\includes.php on line 2
    
    Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in F:\xampp\htdocs\includes.php on line 2
    Code (markup):

    what is my error here?
     
    DK-Tandy, Oct 14, 2010 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    possible reasons:
    1. you have not specified password.
    2. user name you have used does not have permission to connect.
     
    mastermunj, Oct 14, 2010 IP
  3. DK-Tandy

    DK-Tandy Active Member

    Messages:
    330
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #3
    ive tried multiple things and i still get the erorrs?
     
    DK-Tandy, Oct 14, 2010 IP
  4. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #4
    Connection to MySQL haven't been initialized yet. Show us the contents of includes.php.
     
    ActiveFrost, Oct 14, 2010 IP
  5. DK-Tandy

    DK-Tandy Active Member

    Messages:
    330
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #5
    $conn = mysql_connect("".$hostname."","".$data_username."","".$data_password."");  
    mysql_select_db("".$data_basename."") or die(mysql_error());  
    Code (markup):
    is anything wrong with that?
     
    DK-Tandy, Oct 14, 2010 IP
  6. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #6
    Yes.

    $conn = mysql_connect("$hostname", "$data_username", "$data_password") or die(mysql_error());  
    mysql_select_db("$data_basename") or die(mysql_error());
    PHP:
    Let us know whether it works or not.
     
    ActiveFrost, Oct 14, 2010 IP
  7. DK-Tandy

    DK-Tandy Active Member

    Messages:
    330
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #7
    i inputted the code to cure this error, and it made no difference

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'cpauser'@'localhost' (using password: NO) in /home/dk/public_html/config.php on line 7
    
    Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'dk'@'localhost' (using password: NO) in /home/dk/public_html/config.php on line 8
    
    Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/dk/public_html/config.php on line 8
    Access denied for user 'dk'@'localhost' (using password: NO)
    PHP:
    EDIT: these are the errors from installing on my web host. the one at the start was from installing locally!
     
    DK-Tandy, Oct 14, 2010 IP
  8. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #8
    config.php contents on the stage, please !?
     
    ActiveFrost, Oct 14, 2010 IP
  9. DK-Tandy

    DK-Tandy Active Member

    Messages:
    330
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #9
    
    <? 
    ob_start();session_start();
    $hostname = "localhost"; //your hostname (normally localhost)
    $data_username = "dk_sweetus"; //database username
    $data_password = "******"; //database password
    $data_basename = "dk_sweetcollect"; //database name
    $conn = mysql_connect("$hostname", "$data_username", "$data_password") or die(mysql_error());  
    mysql_select_db("$data_basename") or die(mysql_error());
    $bonuspoints=10; //bonus points awarded for new users
    $mainpointsneeded=200; //max number of points needed before user can request voucher
    ?>
    
    PHP:
    thats the config.php file!
     
    DK-Tandy, Oct 14, 2010 IP
  10. SamT

    SamT Peon

    Messages:
    43
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Your error does not reflect your config file. Are you sure you are including it before starting the MySQL connection?
     
    SamT, Oct 15, 2010 IP