Zye
Posts: 56
|
| Posted: 11/16/2007, 10:37 PM |
|
Hi Peeps
I am trying to populate a label (HTML), in the pages HTML.
I want to display the result in all records except for the last one, which will be empty. Something like:
id1 <span class="blue"></span>
id2 <span class="blue"></span>
id3 <span class="blue"></span>
id4 <span class="blue"></span>
id5 This is the last record
I have incorporated a solution that I found on Google (BeforeShow of label) but it populates the label on all returned rows. I am still not familiar with loops as yet.
$db = new clsDBconnection();
$SQL = "SELECT * FROM properties";
$result = mysql_query($SQL);
while($row = mysql_fetch_array($result)) {
$rev_row = array_reverse($row);
$next_to_last = $rev_row[1];
for ($i=0; $i < count($row); $i++) {
$row[$i]. $def_inc->properties_property_type->Label1->SetValue("<span class=\"blue"></span>");
if ($row[$i] == $next_to_last) $def_inc->properties->Label1->SetValue("This is the last record");
}
}
$db->close();
Has anyone had experience with this kind of problem and if so can you help me to solve this.
Cheers!
Zye ...
CCS 3.2 latest, PHP4, MySQL 3/4
|
 |
 |
DonB
|
| Posted: 11/17/2007, 4:33 AM |
|
Seems to me all you need to do is to edit the HTML template page to put in
one more complete row of static HTML with the 'last row' text you want to
display. Add this after the '<!-- END Row -->' marker and before the <!--
END Table -->, and it will appear after all the data rows. No coding
required at all.
--
DonB
http://ccswiki.gotodon.net
"Zye" <Zye@forum.codecharge> wrote in message
news:5473e8c4258427@news.codecharge.com...
> Hi Peeps
>
> I am trying to populate a label (HTML), in the pages HTML.
> I want to display the result in all records except for the last one, which
will
> be empty. Something like:
>
> id1 <span class="blue"></span>
> id2 <span class="blue"></span>
> id3 <span class="blue"></span>
> id4 <span class="blue"></span>
> id5 This is the last record
>
> I have incorporated a solution that I found on Google (BeforeShow of
label) but
> it populates the label on all returned rows. I am still not familiar with
loops
> as yet.
>
> $db = new clsDBconnection();
> $SQL = "SELECT * FROM properties";
> $result = mysql_query($SQL);
> while($row = mysql_fetch_array($result)) {
> $rev_row = array_reverse($row);
> $next_to_last = $rev_row[1];
> for ($i=0; $i < count($row); $i++) {
> $row[$i]. $def_inc->properties_property_type->Label1->SetValue("<span
> class=\"blue"></span>");
> if ($row[$i] == $next_to_last)
$def_inc->properties->Label1->SetValue("This is
> the last record");
> }
> }
> $db->close();
>
> Has anyone had experience with this kind of problem and if so can you help
me
> to solve this.
> Cheers!
>
> Zye ...
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
|
|
|
 |
Zye
Posts: 56
|
| Posted: 11/17/2007, 10:34 AM |
|
Hi DonB
Thanks for your consideration. I tried your suggestion in the HTML template to begin with but it still iterates my html snippet on all rows. I need the last row to print nothing, e.g. like the common loop functions that gets rid of the last comma in a string. I understand what you mean about placing stuff outside the <!-- End Row --> tag.
Have you got any other suggestions. I didn't mention that I am using a CCS gallery builder grid. I have tried my HTML snippet everywhere within it, no success.
Thanks
|
 |
 |
DonB
|
| Posted: 11/20/2007, 4:25 PM |
|
Then you must have put it between the <!-- BEGIN Row --> and <!-- END
Row --> markers. Put it after the END and it will only appear one time,
after all data rows are display. CCS repeats everything that is inside the
BEGIN/END for every row of your data source.
--
DonB
http://ccswiki.gotodon.net
"Zye" <Zye@forum.codecharge> wrote in message
news:5473f3423e028d@news.codecharge.com...
> Hi DonB
>
> Thanks for your consideration. I tried your suggestion in the HTML
template to
> begin with but it still iterates my html snippet on all rows. I need the
last
> row to print nothing, e.g. like the common loop functions that gets rid of
the
> last comma in a string. I understand what you mean about placing stuff
outside
> the <!-- End Row --> tag.
> Have you got any other suggestions. I didn't mention that I am using a CCS
> gallery builder grid. I have tried my HTML snippet everywhere within it,
no
> success.
>
> Thanks
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
|