RE: [PHP] MySQL arrays
| From: | Anzak Wolf | Date: | Tue, 26 Mar 2002 15:31:29 +0000 |
| Subject: | RE: [PHP] MySQL arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-90197@lists.php.net to get a copy of this message | ||
Sorry my mistake the array is $this->query_id the function is $query I still get the same results though.
From: Rick Emery <remery@excel.com> To: 'Anzak Wolf' <anzak@hotmail.com>, php-general@lists.php.net Subject: RE: [PHP] MySQL arrays Date: Tue, 26 Mar 2002 09:23:11 -0600 MIME-Version: 1.0 Received: from [216.92.131.4] by hotmail.com (3.2) with ESMTP id MHotMailBE69DDDA00B840042A0FD85C8304065D0; Tue, 26 Mar 2002 07:25:15 -0800 Received: (qmail 25557 invoked by uid 1010); 26 Mar 2002 15:24:18 -0000 Received: (qmail 25534 invoked from network); 26 Mar 2002 15:24:16 -0000 From php-general-return-90196-anzak Tue, 26 Mar 2002 07:26:42 -0800 Mailing-List: contact php-general-help@lists.php.net; run by ezmlm Precedence: bulk list-help: <mailto:php-general-help@lists.php.net> list-unsubscribe: <mailto:php-general-unsubscribe@lists.php.net> list-post: <mailto:php-general@lists.php.net> Delivered-To: mailing list php-general@lists.php.net Message-ID: <EAA093B474ABD311A71E00508B5FE08305C2D397@adntex03.us.excel.com> X-Mailer: Internet Mail Service (5.5.2653.19) how can you take a size of a function: $len = sizeof($this->query); and WTF (query is a function, not an array): $tq = &$this->query[$q_id]; -----Original Message----- From: Anzak Wolf [mailto:anzak@hotmail.com] Sent: Tuesday, March 26, 2002 9:09 AM To: php-general@lists.php.net Subject: [PHP] MySQL arrays 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 = "") {_________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx$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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php