RES: [PHP-DB] resources and resource types

[email protected] ("Thiago Pojda")
Newsgroups php.db
Message-ID <01de01c89360$9e06fa20$0201a8c0@softpartech>
[top posting warning]

You still did not RTFM as Stut told you 4 days ago. I'm pasting here the
entire conversation with the subject "Resource id #5":

-----Mensagem original-----
De: Stut [mailto:[email protected]] 
Enviada em: quinta-feira, 27 de março de 2008 15:14
Para: Richard Dunne
Cc: [email protected]
Assunto: Re: [PHP-DB] 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/





-----Mensagem original-----
De: Richard Dunne [mailto:[email protected]] 
Enviada em: segunda-feira, 31 de março de 2008 15:40
Para: [email protected]
Assunto: [PHP-DB] resources and resource types

When I did a search on "resource(5)" within the PHP online 
documentation, I found the resource page resource.php. While 
although it lists all the resources used with mysql, it does 
not mention how resources are related to resource numbers as 
above. A query such as a row count on a table results in an 
integer value.  What is the best way of accessing or converting 
the integer value from the resource? I can't see any particular 
function in the function list which does this, without getting 
into strings or arrays, or have I missed something blaringly 
obvious, hope not?




--
PHP Database Mailing List (http://www.php.net/) To unsubscribe, 
visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.