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
RES: resources and resource types
[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 [at] gmail.com]
Enviada em: quinta-feira, 27 de mar=E7o de 2008 15:14
Para: Richard Dunne
Cc: php-db [at] 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
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];
> }
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 [at] o2.ie]
Enviada em: segunda-feira, 31 de mar=E7o de 2008 15:40
Para: php-db [at] lists.php.net
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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: resources and resource types
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
Re: resources and resource types
------=_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 <richarddunne1971 [at] o2.ie>
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
------=_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 [at] 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--