Page 1 of 1

Warning: mysql_connect() - Can't access webpage

Posted: Mon Sep 27, 2010 12:04 am
by JoseT173
Hello,

I'm new to this so if i'm missing information please let me know what I need to provide with. If I posted this in the wrong category I apologize.

I'm trying to access a page and this is the error I am getting:


Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'isaac1_events'@'localhost' (using password: YES) in /home/isaac1/public_html/events/adminpanel/inc/database.inc.php on line 58

Warning: Cannot modify header information - headers already sent by (output started at /home/isaac1/public_html/events/adminpanel/inc/database.inc.php:58) in /home/isaac1/public_html/events/adminpanel/inc/database.inc.php on line 60

Please help!

Re: Warning: mysql_connect() - Can't access webpage

Posted: Mon Sep 27, 2010 12:20 am
by requinix
So have you checked if that user is correct? Right username? Right password?

Re: Warning: mysql_connect() - Can't access webpage

Posted: Mon Sep 27, 2010 12:22 am
by JoseT173
Thank you for your quick reply. I apologize for sound so novice to this but..How do I check that? I'm a designer and basic developer and my PHP/MySQL guy is no where to be found so I'm trying to do this on my own...I would appreciate any direction and solving this.

Re: Warning: mysql_connect() - Can't access webpage

Posted: Mon Sep 27, 2010 12:37 am
by JoseT173
Here is the code for the file it sends me to (database.inc.php)

Code: Select all


<?php
################################################################################
##              -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =-                 #
## --------------------------------------------------------------------------- #
##  PHP AdminPanel Free                                                        #
##  Developed by:  ApPhp <info@apphp.com>                                      # 
##  License:       GNU GPL v.2                                                 #
##  Site:          http://www.apphp.com/php-adminpanel/                        #
##  Copyright:     PHP AdminPanel (c) 2006-2009. All rights reserved.          #
##                                                                             #
##  Additional modules (embedded):                                             #
##  -- PHP DataGrid 4.2.8                   http://www.apphp.com/php-datagrid/ #
##  -- JS AFV 1.0.5                 http://www.apphp.com/js-autoformvalidator/ #
##  -- jQuery 1.1.2                                         http://jquery.com/ #
##                                                                             #
################################################################################


class Database
{
    // Connection parameters
    
    var $host = "";
    var $user = "";
    var $password = "";
    var $database = "";

    var $persistent = false;

    // Database connection handle 
    var $conn = NULL;

    // Query result 
    var $result = false;

//    function DB($host, $user, $password, $database, $persistent = false)
    function Database()
    {
        $config = new Config();

        $this->host = $config->host;
        $this->user = $config->user;
        $this->password = $config->password;
        $this->database = $config->database;
       
    }

    function open()
    {
        // Choose the appropriate connect function 
        if ($this->persistent) {
            $func = 'mysql_pconnect';
        } else {
            $func = 'mysql_connect';
        }

        // Connect to the MySQL server 
        $this->conn = $func($this->host, $this->user, $this->password);
        if (!$this->conn) {
        header("Location: error.html");
        //echo mysql_error();
        exit;
            return false;
        }

        // Select the requested database 
        if (!@mysql_select_db($this->database, $this->conn)) {
            return false;
        }

        return true;
    }

    function close()
    {
        return (@mysql_close($this->conn));
    }

    function error()
    {
        return (mysql_error());
    }

    function query($sql = '')
    {
        $this->result = @mysql_query($sql, $this->conn);
        return ($this->result != false);
    }

    function affectedRows()
    {
        return (@mysql_affected_rows($this->conn));
    }

    function numRows()
    {
        return (@mysql_num_rows($this->result));
    }

    function numCols()
    {
        return @mysql_num_fields($this->result);
    }
    
    function fieldName($field)
    {
       return (@mysql_field_name($this->result,$field));
    }
     function insertID()
    {
        return (@mysql_insert_id($this->conn));
    }
    
    function fetchObject()
    {
        return (@mysql_fetch_object($this->result, MYSQL_ASSOC));
    }

    function fetchArray()
    {
        return (@mysql_fetch_array($this->result, MYSQL_BOTH));
    }

    function fetchAssoc()
    {
        return (@mysql_fetch_assoc($this->result));
    }

    function freeResult()
    {
        return (@mysql_free_result($this->result));
    }
}
?>

Re: Warning: mysql_connect() - Can't access webpage

Posted: Mon Sep 27, 2010 1:09 am
by JoseT173
I figured it out. Thank you for your help. You led me in the right direction.