NYCPHP Meetup

NYPHP.org

[nycphp-talk] need urgent help with MySQL indexing problem

Phil Powell phillip.powell at adnet-sys.com
Wed Mar 17 12:58:28 EST 2004


Actually the client is saying it sometimes happens and sometimes doesn't 
happen, and when they refresh their screen it clears itself (I assume 
the memory clears).

Here is line 1135:
[PHP]$result = mysql_query($this->query, $this->dbcnx) or 
die(@include("$DOCUMENT_ROOT${devpath}errors/query_error.php"));[/PHP]

It is found here in this class method:

class mySqlQuery {

    var $query,$dbcnx; // $dbcnx is a mySqlConnection object   

    function mySqlQuery($query,$dbcnx) {
        $this->query = $query;
        $this->dbcnx = $dbcnx;
    }

    function runQuery() {
        global $devpath,$DOCUMENT_ROOT;   
        if (preg_match('/development\//i', $devpath)) {
         $result = mysql_query($this->query, $this->dbcnx) or 
die(@include("$DOCUMENT_ROOT${devpath}errors/query_error.php?msg=" . 
urlencode(mysql_error())));
        } else {
         $result = mysql_query($this->query, $this->dbcnx) or 
die(@include("$DOCUMENT_ROOT${devpath}errors/query_error.php"));
        }
        return $result;
    }


    function getResult() {
        $runquery = $this->runQuery();
        $count = 0;
        while ($row = mysql_fetch_object($runquery)) {
            $result[$count] = $row;
            $count++;
        }
        return $result;
    }
 
    function getRows($what = 'select') {
        $runquery = $this->runQuery();
        $count = 0;

        if (strcmp(strtolower($what), 'affected') == 0) {
            $row = @mysql_affected_rows($this->dbcnx);
         } else {
                 $row = @mysql_num_rows($this->dbcnx);
         }

        if (!$row) {
            return false;
        }

        return $row;
    }

    function freeResult() {
        @mysql_free_result($this->runQuery());
    }

}

Hans Zaunere wrote:

>>The following occurs when we query records on the 'interns' table:
>>
>>Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to 
>>allocate 40 bytes) in ../intern.inc on line 1135
>>    
>>
>
>Show me line 1135 and a couple lines surrounding it - I bet this isn't a
>MySQL error.
>
>See http://us3.php.net/ini_set and search the page for memory_limit -
>notice it's 8M by default.  Thus, it's probably a PHP error and sloppy
>code.
>
>H
>
>_______________________________________________
>talk mailing list
>talk at lists.nyphp.org
>http://lists.nyphp.org/mailman/listinfo/talk
>
>  
>


-- 
Phil Powell
Web Developer
  ADNET Systems, Inc.
  11260 Roger Bacon Drive, Suite 403
  Reston, VA  20190-5203
Phone: (703) 709-7218 x107   Cell: (571) 437-4430   FAX: (703) 709-7219
EMail:  Phillip.Powell at adnet-sys.com      AOL IM: SOA Dude








More information about the talk mailing list