RES: resources and resource types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[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:stuttle@xxxxxxxxx] 
Enviada em: quinta-feira, 27 de março de 2008 15:14
Para: Richard Dunne
Cc: php-db@xxxxxxxxxxxxx
Assunto: 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/





-----Mensagem original-----
De: Richard Dunne [mailto:richarddunne1971@xxxxx] 
Enviada em: segunda-feira, 31 de março de 2008 15:40
Para: php-db@xxxxxxxxxxxxx
Assunto:  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



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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux