Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Very simple question - sorry

LEGEND ,
Jun 20, 2006 Jun 20, 2006

Copy link to clipboard

Copied

How do I re-use my recordsets in PHP?

I have my page http://demo.mediachurch.com/news.php which, when fed a
variable displays fine, with the selected article in the main body and a
list of other articles to the right.

However, what I want (for right now) is to display the article listing in
the main body as well as the right hand-column, until they select an
article. However, I've completely forgotten how to reset the recordset and
tell it to cycle back to the first record.

This section here isn't a big deal as it's obviously not the best solution
(ie, articles showing on both sides) but I've run into this problem before
and just need a little help.

I've searched on Google, on groups, etc, but my search terms for reuse,
re-use and recycle have come up with nothing.

--

TIA,

Jon Parkhurst
PriivaWeb
http://priiva.net.


TOPICS
Server side applications

Views

419
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 20, 2006 Jun 20, 2006

Copy link to clipboard

Copied

crash wrote:
> How do I re-use my recordsets in PHP?

Reset it with mysql_data_seek().

http://www.php.net/manual/en/function.mysql-data-seek.php

--
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 20, 2006 Jun 20, 2006

Copy link to clipboard

Copied

I have never heard of doing this.

Can you just not make 2 record sets?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 20, 2006 Jun 20, 2006

Copy link to clipboard

Copied

Thanks David.

How do I know which record my recordset is currently on? I see ways to
count the recordsets, but I guess I"m not sure what to feed my stuff to in
the recordset.

bool mysql_data_seek ( resource result, int row_number )

means that

mysql_data_seek($rsNews, 1)

would get me the first row? Since I'm looking for the beginning and not
concerned with the end, I should be able to use a constant to determine the
position, yes?

yuppers! Looks like that did it - thanks a ton man, this is somethign that
I've needed but been too embarassed to post. :)

Jon


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 20, 2006 Jun 20, 2006

Copy link to clipboard

Copied

Not really in this instance. I *could* but I think most of the time people
are going to be clicking on this page to view an article, not to see article
listings. As such, this is more of a error checking than anything else to
ensure there is *some* content on the page. It doesn't really warrant
another recordset.

It was pretty easy from what I remember in ASP to just reset it. Probably
just as easy as it was this time, once I knew what direction to look, lol.

:O)

Jon

"jeremyluby" <webforumsuser@macromedia.com> wrote in message
news:e79alp$nhc$1@forums.macromedia.com...
>I have never heard of doing this.
>
> Can you just not make 2 record sets?


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 20, 2006 Jun 20, 2006

Copy link to clipboard

Copied

crash wrote:
> How do I know which record my recordset is currently on?

If all you want to do is go back to the beginning, it doesn't matter.

> mysql_data_seek($rsNews, 1)
>
> would get me the first row?

I think it should be

mysql_data_seek($rsNews, 0);

--
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 20, 2006 Jun 20, 2006

Copy link to clipboard

Copied

LATEST
ah, you're right. 1 was working, but 0 works better. :)

Yeah, first question I asked before I'd finished reading and absorbing. :)

"David Powers" <david@example.com> wrote in message
news:e79fkl$ssv$1@forums.macromedia.com...
> crash wrote:
>> How do I know which record my recordset is currently on?
>
> If all you want to do is go back to the beginning, it doesn't matter.
>
>> mysql_data_seek($rsNews, 1)
>>
>> would get me the first row?
>
> I think it should be
>
> mysql_data_seek($rsNews, 0);
>
> --
> David Powers
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> Author, "Foundation PHP 5 for Flash" (friends of ED)
> http://foundationphp.com/


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines