MySQL arrays

From: Date: Tue, 26 Mar 2002 15:08:39 +0000
Subject: MySQL arrays
Groups: php.general 
Request: Send a blank email to php-general+get-90194@lists.php.net to get a copy of this message
I'm trying to do something a little different in my database class I have a method to do the query and store it in an array. function query ($s = "") {
       $q = mysql_query($s,$this->database_connect_id);
       if (!$q) {
               $tools->error(array("Query Resulted in NULL value"));
               return 0;
       }
       $len = sizeof($this->query);
       $len++;
       $this->query = array($len=>&$q);
       mysql_free_result($q);
       return $len;
} function num_rows($q_id) {
       // Set temp array to the selected query
       $tq = &$this->query[$q_id];
       $rows = mysql_num_rows($tq);
       return $rows;
} When I do a var_dump of the two key vars I get the following var_dump($this->query); array(1) { [1]=> resource(2) of type (mysql result) } var_dump($tq); resource(2) of type (Unknown) Here is the error that happens when I do the mysql_num_rows <br> <b>Warning</b>: 2 is not a valid MySQL result resource in <b>/var/www/includes/database_class.php</b> on line <b>77</b><br> any ideas as to what I can do to fix this so that I can store query for later use? -Jim _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com

« previous php.general (#90194) next »