PHP/MySQL - Matrix

PHP/MySQL - Matrix

am 02.11.2007 05:58:24 von Eduardo Vizcarra

Hi,

I am developing a web site where I have a photos table, several records from
the photos table can be linked to a different table referentially. When I do
a SELECT to all photos records I can get multiple records, I do not have any
problems doing this, the problem is all the procedure after this.

When I get all the records from the photos table, I am using a web page to
display only the first record, then, if the user hits a next link then the
user should be able to see the next record (next picture) and so on, I do
not want to do a select every time the user hits next or back to get the
picture name and then display it

Is there anyway to do a one SELECT statement, save them in a matrix and then
just go thru it. I am using the same web page to display all pictures, e.g.
the next link points to the same web page where the first picture was
displayed, is it possible to pass a matrix variable ?

Regards,
Eduardo

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

Re: PHP/MySQL - Matrix

am 02.11.2007 06:53:12 von dmagick

> When I get all the records from the photos table, I am using a web page to
> display only the first record, then, if the user hits a next link then the
> user should be able to see the next record (next picture) and so on, I do
> not want to do a select every time the user hits next or back to get the
> picture name and then display it

Why? You're selecting one record - it will be quick as long as you're db
is indexed correctly.

> Is there anyway to do a one SELECT statement, save them in a matrix and then
> just go thru it. I am using the same web page to display all pictures, e.g.
> the next link points to the same web page where the first picture was
> displayed, is it possible to pass a matrix variable ?

Sure. Stuff it all in an array and then save it in the session.

--
Postgresql & php tutorials
http://www.designmagick.com/

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

Re: PHP/MySQL - Matrix

am 02.11.2007 07:15:15 von Eduardo Vizcarra

Hi Chris

How do I save the matrix in the session ?

Actually, my first question is, what do you mean by a session ?

Regards
Eduardo

"Chris" escribió en el mensaje
news:472ABB48.7030306@gmail.com...
>
>> When I get all the records from the photos table, I am using a web page
>> to display only the first record, then, if the user hits a next link then
>> the user should be able to see the next record (next picture) and so on,
>> I do not want to do a select every time the user hits next or back to get
>> the picture name and then display it
>
> Why? You're selecting one record - it will be quick as long as you're db
> is indexed correctly.
>
>> Is there anyway to do a one SELECT statement, save them in a matrix and
>> then just go thru it. I am using the same web page to display all
>> pictures, e.g. the next link points to the same web page where the first
>> picture was displayed, is it possible to pass a matrix variable ?
>
> Sure. Stuff it all in an array and then save it in the session.
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/

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

Re: PHP/MySQL - Matrix

am 02.11.2007 07:25:15 von dmagick

Eduardo Vizcarra wrote:
> Hi Chris
>
> How do I save the matrix in the session ?
>
> Actually, my first question is, what do you mean by a session ?

http://www.php.net/session

Look under the examples.

--
Postgresql & php tutorials
http://www.designmagick.com/

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