Resource id #5

Can someone explain how I can translate Resource id #5 which is what I am getting from the code below?

$result = mysql_query("Select answer from answers") or die(mysql_error());
$resultArray = explode(',',$result);
for ($i=0;$i<sizeof($resultArray);$i++)
{
echo $resultArray[$i];
}



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Richard Dunne [ Do, 27 März 2008 18:51 ] [ ID #1930924 ]

RE: Resource id #5

Been a positive integer, it jeans that the SQL query was succesfully
executed, read the function description.

__________________
Miguel Guirao Aguilera, Linux+, ITIL
Sistemas de Informaci=F3n
Inform=E1tica R8
Ext. 7540

--> -----Original Message-----
--> From: Richard Dunne [mailto:richarddunne1971 [at] o2.ie]
--> Sent: Thursday, March 27, 2008 11:51 AM
--> To: php-db [at] lists.php.net
--> Subject: [PHP-DB] Resource id #5
-->
--> Can someone explain how I can translate Resource id #5 which is what =
I
--> am getting from the code below?
-->
--> $result =3D mysql_query("Select answer from answers") or
--> die(mysql_error());
--> $resultArray =3D explode(',',$result);
--> for ($i=3D0;$i<sizeof($resultArray);$i++)
--> {
--> echo $resultArray[$i];
--> }
-->
-->
-->
--> --
--> PHP Database Mailing List (http://www.php.net/)
--> To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
MIGUEL ANTONIO GUIRAO [ Do, 27 März 2008 18:58 ] [ ID #1930925 ]

Re: Resource id #5

On 27 Mar 2008, at 17:51, Richard Dunne wrote:
> Can someone explain how I can translate Resource id #5 which is what
> I am getting from the code below?
>
> $result = mysql_query("Select answer from answers") or
> die(mysql_error());
> $resultArray = explode(',',$result);
> for ($i=0;$i<sizeof($resultArray);$i++)
> {
> echo $resultArray[$i];
> }

For the love of $DEITY, please read the frickin' manual: http://php.net/mysql
.. You've been asking similar questions around this topic for the past
few days and you clearly haven't moved forward in your understanding.

The mysql_query function returns a resource. If you print a resource
you get the text "Resource id #n" where n is replaced with its ID. To
make use of this resource you need to use functions like
mysql_fetch_array, mysql_fetch_assoc or one of the many others
detailed in, you guessed it, the manual. Try it, you might like it.

-Stut

--
http://stut.net/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Stut [ Do, 27 März 2008 19:14 ] [ ID #1930926 ]
PHP » gmane.comp.php.database » Resource id #5

Vorheriges Thema: Table optimization ideas needed
Nächstes Thema: Not updating certain fields in same row