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