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

two repeat regions of the same recordset

New Here ,
Dec 06, 2006 Dec 06, 2006
Hi,

I have 1 employee recordset with 70 fields. I have searated the info into 7 layers (general info, contact details, transport licences etc.).

I want to apply a repeat region on each of the layers, but DW seems to be limiting me to only applying a single repeat region per recordset.

I have tried pasting the first repeat regions code (below) around a <tr> in a different layer, but no data displays,

<?php do { ?>

<?php } while ($row_cand = mysql_fetch_assoc($cand)); ?>


IS there any way to accomplish this, or do I have to duplicate and rename the recordset 7 times (one for each layer)....the code bloat would be horrific?

Many thanks
TOPICS
Server side applications
790
Translate
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 ,
Dec 06, 2006 Dec 06, 2006
Generally, recordsets are returned with read-only, forward-only cursors
(firehose mode), and once you've looped all the way through, you've got to
requery the recordset. I'm afraid I don't know the PHP equivalent, but
depending on cursor type and location, there will be a "moveFirst" or
"requery" method that will do that for you.

You might be able to cheat if you don't know the command. DW automatically
resets a recordset used as the source for a list box in a form. See what DW
writes after it creates the list options and that will tell you what the
appropriate requery command will be.


"lazlo2005" <webforumsuser@macromedia.com> wrote in message
news:el69n1$c5e$1@forums.macromedia.com...
> Hi,
>
> I have 1 employee recordset with 70 fields. I have searated the info into
> 7
> layers (general info, contact details, transport licences etc.).
>
> I want to apply a repeat region on each of the layers, but DW seems to be
> limiting me to only applying a single repeat region per recordset.
>
> I have tried pasting the first repeat regions code (below) around a <tr>
> in a
> different layer, but no data displays,
>
> <?php do { ?>
>
> <?php } while ($row_cand = mysql_fetch_assoc($cand)); ?>
>
>
> IS there any way to accomplish this, or do I have to duplicate and rename
> the
> recordset 7 times (one for each layer)....the code bloat would be
> horrific?
>
> Many thanks
>


Translate
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 ,
Dec 06, 2006 Dec 06, 2006
What you need to do is reset the recordset and then manually recopy your
repeat region behavior (it might show up in the he UI, but I don' think you
can set it from there).

Use this to reset your recordset in PHP:

mysql_data_seek($RecordsetNAME, 0);

So:
<?php do { ?>


<?php
} while ($row_cand = mysql_fetch_assoc($cand));

mysql_data_seek($cand, 0);

//then, you can start your next recordset repeat region wherever.

?>



"lazlo2005" <webforumsuser@macromedia.com> wrote in message
news:el69n1$c5e$1@forums.macromedia.com...
> Hi,
>
> I have 1 employee recordset with 70 fields. I have searated the info into
> 7
> layers (general info, contact details, transport licences etc.).
>
> I want to apply a repeat region on each of the layers, but DW seems to be
> limiting me to only applying a single repeat region per recordset.
>
> I have tried pasting the first repeat regions code (below) around a <tr>
> in a
> different layer, but no data displays,
>
> <?php do { ?>
>
> <?php } while ($row_cand = mysql_fetch_assoc($cand)); ?>
>
>
> IS there any way to accomplish this, or do I have to duplicate and rename
> the
> recordset 7 times (one for each layer)....the code bloat would be
> horrific?
>
> Many thanks
>


Translate
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
New Here ,
Dec 07, 2006 Dec 07, 2006
many thanks,

mysql_data_seek($cand, 0);

worked a treat, much appreciated.
Translate
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 ,
Dec 07, 2006 Dec 07, 2006
no worries


Translate
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
New Here ,
Dec 10, 2006 Dec 10, 2006
HI,

using the mysql_data_seek($cand, 0); method, on subsequent repeated regions, I'm experiencing a blank line, for example:

cand has two records, (adam, jim)

1st repeat shows adam and jim (2 rows)

2nd repeat region show an empty row, then adam, then jim. (3 rows)
I've tried

mysql_data_seek($cand, -1); (-1 instead of 0)

but this just errors.

any ideas?

Translate
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 ,
Dec 10, 2006 Dec 10, 2006
lazlo2005 wrote:
> using the mysql_data_seek($cand, 0); method, on subsequent repeated regions,
> I'm experiencing a blank line

It's because of the way that Dreamweaver creates recordsets and repeat
regions. A Dreamweaver repeat region uses a do... while loop like this:

<?php do { ?>
<tr>
<td><?php echo $row_recordsetName['name']; ?></td>
</tr>
<?php } while ($row_recordsetName = mysql_fetch_assoc($recordsetName)); ?>

This is works because the recordset code above the DOCTYPE automatically
retrieves the first row. However, when you use mysql_data_seek(), you
need to get the first row yourself like this:

<?php
// reset the recordset back to the first item
mysql_data_seek($recordsetName, 0);
// get the first row
$row_recordsetName = mysql_fetch_assoc($recordsetName);
// then use the Dreamweaver repeat region code
?>
<?php do { ?>
<tr>
<td><?php echo $row_recordsetName['name']; ?></td>
</tr>
<?php } while ($row_recordsetName = mysql_fetch_assoc($recordsetName)); ?>

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
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
New Here ,
Dec 10, 2006 Dec 10, 2006
LATEST
<phew>
thanks for that, no blank line!
Translate
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