Resource id #5

Resource id #5

am 27.03.2008 18:51:18 von Richard Dunne

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 {
echo $resultArray[$i];
}



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Resource id #5

am 27.03.2008 18:58:17 von MIGUEL ANTONIO GUIRAO AGUILAR

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

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

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

Re: Resource id #5

am 27.03.2008 19:14:00 von Stut

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 > {
> 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