Results 1 to 8 of 8

Thread: Database Access Error

  1. #1
    biggles
    Guest

    Default Database Access Error

    Hi,

    I'm a newbie here and I'm not getting much joy from the support people.

    Whenever I try to enter a new profile or change either my profile as a member or any profile in admin I keep getting a database access error. I've checked that my database details are correct in Modules but the problem persists.

    Can anyone help me?

  2. #2
    biggles
    Guest

    Default

    I fixed the problem by deleting the database and creating a new one with install. Luckily i was not active.

  3. #3
    rr1024's Avatar
    Join Date
    Mar 2005
    Posts
    152

    Default Add a Debug mod

    to db.inc.php
    So you can output errors to find out were the trouble is

    Here is one I did
    you just need to at $DEBUG = false; to your header.inc.php Then change it to true to see the errors.

    Code:
    <?php
    /*
    (C) AEwebworks Software Development Ltd., 2002-2004
    IMPORTANT: This is a commercial software product and any kind of using it must agree
    to the AEwebworks Software Development Ltd. license agreement. It can be found at
    http://www.aewebworks.com/license.htm
    This notice may not be removed from the source code.
    
    Changes are all in this file unless otherwise noted, search for date of mod,
    each mod is commented with first line of change log.
    
    CHANGE LOG:
    02.25.05 MOD R2 Fix for SQL Max User connections error
             For Shared Server, we may not always get a connection to mysql esp if someone
             has errors in their code. This was added to help fix the problem and generate a
             nice user message should max connections be reached.
    
    
    04.15.05 MOD R2 Error Reporting Fucntion With $DEBUG
             For Turning Error reporting on and off during sql queries to display or trap
             errors for display in web browser.
             Other Files Affected
               Open: headder.inc.php
                Find: $BUG_REPORT_EMAIL
                Below Add: $DEBUG = false;
             Change $DEBUG to false when running on live server or when you don't
             want path and errors to be displayed
    
    ================================================================================
                 db.inc.php Class for data base access
    ================================================================================
    */
    
    class CMySQL
    {
            var $host, $sock, $port, $user, $passwd, $db, $connected, $link;
    
        function connect()
            {
                if ( $this->connected )
                        return;
                    if (strlen($this->port)) $this->port = ":".$this->port;
                    if (strlen($this->sock)) $this->sock = ":".$this->sock;
    
    //-- 02.25.05 MOD R2 Fix for SQL Max User connections error
    //            $this->link = mysql_pconnect( $this->host . $this->port . $this->sock, $this->user, $this->passwd );
    
                $attempts = 75;  // Set the number of Trys to connect to MySQL
                $delay = 50000;  //  Delay in microseconds
    
                for ( $i = 0; $i < $attempts; $i++)
                {
                     if ( !$this->link = @mysql_pconnect( $this->host . $this->port . $this->sock, $this->user, $this->passwd ) )
                     {
                          usleep($delay);  //  Not available on windows before PHP 5.0
                     }
                     else
                     {
                          break;
                     }
                }
    
                if ( !$this->link )
                {
                     echo "<table align=center border=\"1\" cellpadding=\"2\" cellspacing=\"2\" style=\"border-color:#9C21A5\"><tr><td bgcolor=\"#9C21A5\">";
                     echo "<font color=white face=\"Arial, Helvetica, sans-serif\"><b>YOUR  Community Server NAME HERE is Temporaraily Busy!</b></font>";
                     echo "</td></tr>";
                     echo "<tr><td>";
                     echo "Our YOUR SITE NAME Community is currently in HIGH DEMAND!<br>USE your browers refresh or back button in just few seconds.</b><br>Please, Please, Please try again. We appreciate your patience and we very, very, very SORRY for the inconvenience.<br><br>We are experiencing some growing pains and we know this hurts you, so an Error report has been sent.";
                     echo "<br>Error Code ( inc 30 )";
                     echo "</td></tr></table>";
                     exit;
                   //  EXIT to prevent any other code from running
                }
    //-- [ END ] 02.25.05 MOD R2 Fix for SQL Max User connections error
                if ( $this->link ) $this->connected = TRUE;
                else $this->connected = FALSE;
            }
    
            function select_db()
            {
                return mysql_select_db( $this->db );
            }
    }
    
    $MySQL               = new CMySQL;
    
    $MySQL->host         = $db['host'];
    $MySQL->sock         = $db['sock'];
    $MySQL->port         = $db['port'];
    $MySQL->user         = $db['user'];
    $MySQL->passwd       = $db['passwd'];
    $MySQL->db           = $db['db'];
    $MySQL->connected    = FALSE;
    
    
    $MySQL->connect();
    $MySQL->select_db();
    
    function db_connect()
    {
            global $MySQL;
            global $BUG_REPORT_EMAIL;
    
    
            if ( !$MySQL->select_db() )
            {
                 echo PrintErr( "Database activation failed: db_connect" );
                 mail( $BUG_REPORT_EMAIL, "Error", "Error in $_SERVER[PHP_SELF]: " . mysql_error() );
    
                 //-- 04.15.05 MOD R2 Error Reporting Fucntion With $DEBUG
                 $msg = "Error in $_SERVER[PHP_SELF]: " . mysql_error();
                 db_report_error( $msg);
                 //-- [END 04.15.05 MOD R2]
    
                 exit;
            }
        return true;
    }
    
    function db_list_tables( $error_checking = 1 )
    {
            global $BUG_REPORT_EMAIL;
            global $MySQL;
    
            $res = mysql_list_tables($MySQL->db);
    
            if ( $error_checking && !$res )
            {
                echo PrintErr( "Database access error: db_list_tables" );
    
                mail( $BUG_REPORT_EMAIL, "Error", "Error in $_SERVER[PHP_SELF]: " . mysql_error() . "\n" );
    
                //-- 04.15.05 MOD R2 Error Reporting Fucntion With $DEBUG
                $msg = "Error in $_SERVER[PHP_SELF]: " . mysql_error();
                db_report_error( $msg);
                //-- [END 04.15.05 MOD R2]
    
                exit;
            }
        return $res;
    }
    
    function db_get_encoding ( $error_checking = 1 )
    {
            global $BUG_REPORT_EMAIL;
            global $MySQL;
    
            $res = mysql_client_encoding($MySQL->link);
            if ( $error_checking && !$res )
            {
                 echo PrintErr( "Database access error: db_get_encoding" );
    
                 mail( $BUG_REPORT_EMAIL, "Error", "Error in $_SERVER[PHP_SELF]: " . mysql_error() );
    
                 //-- 04.15.05 MOD R2 Error Reporting Fucntion With $DEBUG
                 $msg = "Error in $_SERVER[PHP_SELF]: " . mysql_error();
                 db_report_error( $msg);
                 //-- [END 04.15.05 MOD R2]
    
                 exit;
            }
    
        return $res;
    }
    
    function db_res( $query, $error_checking = 1 )
    {
            global $BUG_REPORT_EMAIL;
            global $MySQL;
    
            $res = mysql_query( $query, $MySQL->link );
            if ( $error_checking && !$res )
            {
                 echo PrintErr( "Database access error: db_res" );
    
                 mail( $BUG_REPORT_EMAIL, "Error", "Error in $_SERVER[PHP_SELF]: " . mysql_error() . "\nQuery: '$query'" );
    
                 //-- 04.15.05 MOD R2 Error Reporting Fucntion With $DEBUG
                 $msg = "Error in $_SERVER[PHP_SELF]: " . mysql_error() . "\nQuery: '$query'";
                 db_report_error( $msg);
                 //-- [END 04.15.05 MOD R2]
    
                 exit;
            }
        return $res;
    }
    
    function db_arr( $query, $error_checking = 1  )
    {
            global $BUG_REPORT_EMAIL;
            global $MySQL;
    
            $res = mysql_query( $query, $MySQL->link  );
            if ( $error_checking && !$res )
            {
                 echo PrintErr( "Database access error: db_arr" );
    
                 mail( $BUG_REPORT_EMAIL, "Error", "Error in $_SERVER[PHP_SELF]: " . mysql_error() . "\nQuery: '$query'" );
    
                 //-- 04.15.05 MOD R2 Error Reporting Fucntion With $DEBUG
                 $msg = "Error in $_SERVER[PHP_SELF]: " . mysql_error() . "\nQuery: '$query'";
                 db_report_error( $msg);
                 //-- [END 04.15.05 MOD R2]
    
                 exit;
            }
        $arr = mysql_fetch_array( $res );
        return $arr;
    }
    
    function fill_array( $res )
    {
            global $MySQL;
    
            if ( !$res )
                 return false;
    
            $i = 0;
            $arr = array();
    
            while( $r = mysql_fetch_array( $res ) )
                 $arr[$i++] = $r;
    
        return $arr;
    }
    
    function getParam( $param_name )
    {
            if ( !$line = db_arr( "SELECT VALUE FROM GlParams WHERE Name = '$param_name'" ) )
                 return false;
        return $line[VALUE];
    }
    
    function getParamDesc( $param_name )
    {
            if ( !$line = db_arr( "SELECT `desc` FROM GlParams WHERE Name = '$param_name'" ) )
                 return false;
        return $line[desc];
    }
    
    
    function setParam( $param_name, $param_val )
    {
            $param_val = str_replace_mysql ($param_val);
            if ( !$res = db_res( "UPDATE GlParams SET VALUE = '$param_val' WHERE Name = '$param_name'" ) )
                 return false;
        return true;
    }
    
    
    function str_replace_mysql($str)
    {
            $option = $str;
            $option_tmp = "";
            $len = strlen($option);
            for ($i = 0 ; $i<$len ; ++$i )
            {
                if ( $i == 0 )
                {
                    if ( $option[$i] == "'" )  $option_tmp .= "\\";;
                }
                else
                {
                    if ( $option[$i] == "'" && $option[$i-1] != "\\")
                    {
                        $option_tmp .= "\\";
                    }
                }
                $option_tmp .= $option[$i];
                //$option = str_replace("'","\\'",$option);
            }
    
        return $option_tmp;
    }
    
    function PrintErr($out)
    {
            $ret  = "<table cellspacing=2 cellpadding=2 align=center style=\"border: 1px solid red\"><tr><td bgcolor=red>";
            $ret .= "<font color=white><b>Error</b></font>";
            $ret .= "</td></tr>";
            $ret .= "<tr><td>";
            $ret .= $out;
            $ret .= "</td></tr></table>";
        return $ret;
    }
    
    //-- 04.15.05 MOD R2 Error Reporting Fucntion With $DEBUG
    function db_report_error($msg){
            global $DEBUG;
            global $BUG_REPORT_EMAIL;
    
            if ( $DEBUG )
            {
                trigger_error($msg,E_USER_ERROR);
            }
            else
            {
                mail( $BUG_REPORT_EMAIL, "Error", $msg);
            }
            exit;
    }
    //-- [END 04.15.05 MOD R2]
    
    if ( !db_connect() )
            exit();
    
    
    ?>
    Windows defined as 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition.
    -----------------------------------------------------
    My Aed site
    Adult Sex Toys My Web Real Estate Web Hosting Real Estate Realtors fed state taxes

  4. #4
    Administrator Smoge's Avatar
    Join Date
    Mar 2005
    Posts
    6,634
    Blog Entries
    5

    Default Re: Database Access Error

    Quote Originally Posted by biggles
    Hi,

    I'm a newbie here and I'm not getting much joy from the support people.

    Whenever I try to enter a new profile or change either my profile as a member or any profile in admin I keep getting a database access error. I've checked that my database details are correct in Modules but the problem persists.

    Can anyone help me?
    Yes, the debug help others have told you can be a lifesaver - it is something everyone should use if they are doing any development or changes to their aeDating.

    But, in general, when you get a database error when you add or update a profile, it is because your database tables; Profiles and ProfilesDesc do not match.

    The Profiles table stores the user profiles, while the ProfileDesc table builds the input forms for the site.

    Both have to have values that sync - or you will have a database error, or other problems, like your checkboxes and so on not being saved.

    Smoge
    ModMySite Administrator

    Problems? Questions? Need modifications or other help with your site?

    Open A Ticket , Send Us An Email Or Give Us A Telephone Call +1 518-632-4152.

  5. #5
    Greg504
    Guest

    Default Same problem

    Hi guys I'm havingg the same problem, I think it is a database corruption, is there a way of re-synching the two profile tables.

    Been at it for days and really not getting anywhere.

    Would rather not have to reinstall the site, or restore a database back up. I have installed flashchat and forum and everything is working nicely, except this pesky profile issue.

    Any advice would be greatt

    Thanks

  6. #6
    Drakontas
    Guest

    Default

    I started to have (and now still have) this same problem after I began to customize the Profile Fields through the AdminControl Panel. I changed some Profile Field values, deleted some Profile Fields and Added New Profile Fields.

    Now I get regular Database Access Error messages when the search is used, even when I try to save a change in the Admin Control Panel.

  7. #7

    Join Date
    Nov 2007
    Posts
    12

    Default

    I have the same problem

  8. #8
    Administrator Smoge's Avatar
    Join Date
    Mar 2005
    Posts
    6,634
    Blog Entries
    5

    Default

    Quote Originally Posted by lo2y View Post
    I have the same problem
    You responded to a really old post (2006).... I answered in your other post... put in a post here the contents of one of your debug emails and we can take a look.

    Warm regards,
    Smoge
    ModMySite Administrator

    Problems? Questions? Need modifications or other help with your site?

    Open A Ticket , Send Us An Email Or Give Us A Telephone Call +1 518-632-4152.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Database access error
    By x151x in forum General Troubleshooting
    Replies: 3
    Last Post: 06-14-2007, 03:55 AM
  2. Database access error after database upload
    By sanne in forum Database
    Replies: 1
    Last Post: 06-03-2007, 06:49 AM
  3. Database access error
    By BeastMaster in forum Bugs Dolphin v.5.3.0
    Replies: 4
    Last Post: 04-10-2007, 03:36 PM
  4. Database Access Error
    By midnight251 in forum Database
    Replies: 26
    Last Post: 01-24-2007, 09:31 PM
  5. Database access error
    By shakir in forum General Troubleshooting
    Replies: 3
    Last Post: 11-30-2006, 01:12 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •