Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Oct 2004
    Posts
    45
    Member #
    7875
    Hi, I'm following a CMS tutorial and when trying to post a new article, I get this error:

    Code:
    Warning: mysql_connect(): Access denied for user 'fovi'@'localhost' (using password: NO) in /home/fovi/public_html/includes/dbconnector.php on line 26
    
    Warning: mysql_select_db(): Access denied for user 'fovi'@'localhost' (using password: NO) in /home/fovi/public_html/includes/dbconnector.php on line 27
    
    Warning: mysql_select_db(): A link to the server could not be established in /home/fovi/public_html/includes/dbconnector.php on line 27
    
    Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/fovi/public_html/includes/dbconnector.php on line 36
    Sorry, there was an error saving to the database
    
    Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/fovi/public_html/includes/dbconnector.php on line 50
    Here is my DbConnector.php :

    Code:
    <?php
    ////////////////////////////////////////////////////////////////////////////////////////
    // Class: DbConnector
    // Purpose: Connect to a database, MySQL version
    ///////////////////////////////////////////////////////////////////////////////////////
    require_once 'SystemComponent.php';
    
    class DbConnector extends SystemComponent {
    
        var $theQuery;
        var $link;
    
        //*** Function: DbConnector, Purpose: Connect to the database ***
        function DbConnector(){
    
            // Load settings from parent class
            $settings = SystemComponent::getSettings();
    
            // Get the main settings from the array we just loaded
            $host = $settings['dbhost'];
            $db = $settings['dbname'];
            $user = $settings['dbusername'];
            $pass = $settings['dbpassword'];
    
            // Connect to the database
            $this->link = mysql_connect($host, $user, $pass);
            mysql_select_db($db);
            register_shutdown_function(array(&$this, 'close'));
    
        }
    
        //*** Function: query, Purpose: Execute a database query ***
        function query($query) {
    
            $this->theQuery = $query;
            return mysql_query($query, $this->link);
    
        }
    
        //*** Function: fetchArray, Purpose: Get array of query results ***
        function fetchArray($result) {
    
            return mysql_fetch_array($result);
    
        }
    
        //*** Function: close, Purpose: Close the connection ***
        function close() {
    
            mysql_close($this->link);
    
        }
    
    
    }
    ?>
    I'm not sure whether I should specify the db name, user etc in DbConnector.php or not, because I've done that in SystemComponent.php and I've double-checked that they're correct. I've tried specifying them here but I still get the same error.

    Can anyone help?

    Thanks!

  2.  

  3. #2
    Member
    Join Date
    Oct 2004
    Posts
    45
    Member #
    7875
    Nevermind, I've sorted it! Sorry!

  4. #3
    Senior Member tha_Gsheep's Avatar
    Join Date
    Feb 2003
    Location
    Scotland
    Posts
    188
    Member #
    780
    Just for others viewing this thread, the password was wrong hence the "using PASSWORD: NO"
    www.appletv.co.uk


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:22 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com