resources and resource types

resources and resource types

am 31.03.2008 20:39:54 von Richard Dunne

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

RES: resources and resource types

am 31.03.2008 20:54:15 von Thiago Pojda

[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@gmail.com]=20
Enviada em: quinta-feira, 27 de mar=E7o de 2008 15:14
Para: Richard Dunne
Cc: php-db@lists.php.net
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=20
is what I=20
> am getting from the code below?
>
> $result =3D mysql_query("Select answer from answers") or=20
> die(mysql_error()); $resultArray =3D explode(',',$result); for=20
> ($i=3D0;$i > {
> echo $resultArray[$i];
> }

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

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

-Stut

--
http://stut.net/





-----Mensagem original-----
De: Richard Dunne [mailto:richarddunne1971@o2.ie]=20
Enviada em: segunda-feira, 31 de mar=E7o de 2008 15:40
Para: php-db@lists.php.net
Assunto: [PHP-DB] resources and resource types

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




--
PHP Database Mailing List (http://www.php.net/) To unsubscribe,=20
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: resources and resource types

am 31.03.2008 20:56:01 von andresmontanez

The ID of the resource changes on every new resource.
There is no co-relation between resources and resources id.

The only thing you can get is the Type of the Resource, read:
* http://www.php.net/manual/en/language.types.resource.php
* http://www.php.net/manual/en/resource.php
* http://www.php.net/manual/en/function.get-resource-type.php


--=20
Atte, Andr=E9s G. Monta=F1ez
PHP Senior
T=E9cnico en Telecomunicaciones
Montevideo - Uruguay

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

Re: resources and resource types

am 31.03.2008 22:49:25 von jonllmsed

------=_Part_7751_32667160.1206996565578
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Here's the manual: http://php.net/language.types.resource

Also: http://php.net/resource
An entire list of all possible resource types and respective functions.

Read up, man.

- Jon L.

On Mon, Mar 31, 2008 at 1:39 PM, Richard Dunne
wrote:

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

------=_Part_7751_32667160.1206996565578--

Re: resources and resource types

am 31.03.2008 22:50:36 von jonllmsed

------=_Part_7762_14885563.1206996636637
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

What I get for not refreshing. ;)

Sorry, man. Didn't know you already gave the links.

- Jon L.

On Mon, Mar 31, 2008 at 1:56 PM, Andr=E9s G. Monta=F1ez <
andresmontanez@gmail.com> wrote:

> The ID of the resource changes on every new resource.
> There is no co-relation between resources and resources id.
>
> The only thing you can get is the Type of the Resource, read:
> * http://www.php.net/manual/en/language.types.resource.php
> * http://www.php.net/manual/en/resource.php
> * http://www.php.net/manual/en/function.get-resource-type.php
>
>
> --
> Atte, Andr=E9s G. Monta=F1ez
> PHP Senior
> T=E9cnico en Telecomunicaciones
> Montevideo - Uruguay
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

------=_Part_7762_14885563.1206996636637--