Jump to content

sngskunk

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Posts posted by sngskunk

  1. Im trying to make a class to connect to my mysql database but for some reason its not working cand you tell me what i need to do.

    [code]
    <?php

    class DB_Connect {
      
      var $server;
      var $username;
      var $password;
      var $database;
      
      function db_connect() {
        
        $dbserver = $this->server;
        $dbuser = $this->username;
        $dbpass = $this->password;
        $db = $this->database;
        
        $connect = mysql_connect($dbserver, $dbuser, $dbpass);
        mysql_select_db($db, $connect);    
        
      }
    }

    $db = new DB_Connect;
    $db->server = "localhost";
    $db->username = "user";
    $db->password = "pass";
    $db->database = "database";
    $db->db_connect();

    ?>
    [/code]

    I get this error:

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\Program Files (x86)\xampp\htdocs\portal\new\test.php on line 17

    Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in C:\Program Files (x86)\xampp\htdocs\portal\new\test.php on line 18

    But the server, username, password, and database are correct. Help???
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.