RE: [PHP] Weird error...
| From: | Kevin Stone | Date: | Fri, 22 Mar 2002 17:42:28 +0000 |
| Subject: | RE: [PHP] Weird error... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-89715@lists.php.net to get a copy of this message | ||
DOH!!! I didn't mean to email the first part of my response below. I
wrote it and then realized that I was mistaken. I thought I'd erased
it. It is perfectly valid to do what you want with mysql_result(); :)
-Kevin
-----Original Message-----
From: Kevin Stone [mailto:kevin@helpelf.com]
Sent: Friday, March 22, 2002 10:38 AM
To: php-general@lists.php.net
Subject: RE: [PHP] Weird error...
--------------
I notice you're incrementing the row offset. You shouldn't use
mysql_result() to extract multiple fields like that. It will be much
faster using mysql_fetch_array() once and then extracting any data you
need from the resulting associative array as many times as you need.
Mysql_result() is intended to be used when you need to extract the data
in one field in one column.
------------
I can only think it has something to do with your $results_all. Perhaps
there is a max size that it will accept? Doesn't make sense though. I
tried this and it worked fine:
<?php
// open dbase not shown
$query = "SELECT * FROM montileaux_events";
$result = mysql_query ($query, $db);
$num = mysql_num_rows($result);
for ($i=0; $i<$num; $i++)
{
echo mysql_result($result, $i, "event_location") . "<br>";
}
?>
For extracting multiple sets of data you should be using one of the
mysql_fetch_XXX() functions instead. Example..
$row = mysql_fetch_array($result);
echo $row[event_location]. "<br>";
-Kevin
-----Original Message-----
From: Phil Schwarzmann [mailto:pschwar@jhmi.edu]
Sent: Friday, March 22, 2002 9:27 AM
To: php-general@lists.php.net
Subject: [PHP] Weird error...
What does this error mean??
Fatal error: Allowed memory size of 8388608 bytes exhausted at
zend_language_scanner.c:4248 (tried to allocate 9 bytes) in
/blah/blah/afteradmin2.php on line 37
here is line #37...
$usertemp = mysql_result($result_all, $i, "username");
THANKS!!!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php