On Friday, January 11, 2002, at 05:42 PM, Nick Wilson wrote:
> That's not it. Your first $result is a resource indicator (container for
> results) so if you re-assign it (put another value into it) it becomes
> useless as your while statement depends on it.
(This may be redundant, but I'm hoping that someday someone will find
this info in the archives as helpful:)
<INSIGHT!>
Now I understand. I was mistaken in the way that I first conceptualized
the following:
$sql = "some SQL code";
$result = mysql_query($sql, $db);
Originally, I thought that $result was just a variable that represented
the function "mysql_query($sql, $db)". And when $result is called by,
for instance, mysql_fetch_array(), in the form
"mysql_fetch_array($result)", all I was really doing was making a more
organized form of this:
mysql_fetch_array((mysql_query($sql, $db)))
But no! It appears that defining the variable $result like so:
$result = mysql_query($sql, $db);
Is actually performing an operation! The mysql_query() function happens
at this time! Not during the mysql_fetch_array() as I previously
thought.
If what I have written above here is correct (and I hope it is) then you
have helped me learn a fundamental element of the way PHP works, at
least with this command. I had not been thinking of $result as a
"container for results" before, rather as a "container for another
function for later use".
Awesome.
Erik
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]