|
Posted by frizzle on 01/02/06 21:55
mathijs rooda wrote:
> Hello,
>
> I hope someone can help me.
> I have a script that shows the last 8 rows of a recordset. the rows a
> seperated by a dottet line that is a gif in the repeat region. look at
> picture http://www.gameology.de/naamloos.gif
> my problem is that i dont want to show the last dottet line on the last row
> of the record. see arrow at picture.
> any knows how to do that??
> Code :
>
> <?php
> $maxRows_newsleft = 8;
> $pageNum_newsleft = 0;
> if (isset($_GET['pageNum_newsleft'])) {
> $pageNum_newsleft = $_GET['pageNum_newsleft'];
> }
> $startRow_newsleft = $pageNum_newsleft * $maxRows_newsleft;
>
> mysql_select_db($database_clan, $clan);
> $query_newsleft = "SELECT * FROM news ORDER BY datesubmit DESC";
> $query_limit_newsleft = sprintf("%s LIMIT %d, %d", $query_newsleft,
> $startRow_newsleft, $maxRows_newsleft);
> $newsleft = mysql_query($query_limit_newsleft, $clan) or die(mysql_error());
> $row_newsleft = mysql_fetch_assoc($newsleft);
>
> if (isset($_GET['totalRows_newsleft'])) {
> $totalRows_newsleft = $_GET['totalRows_newsleft'];
> } else {
> $all_newsleft = mysql_query($query_newsleft);
> $totalRows_newsleft = mysql_num_rows($all_newsleft);
> }
> $totalPages_newsleft = ceil($totalRows_newsleft/$maxRows_newsleft)-1;
>
> ?>
> <?php
> // for changing colors in background
> //$kleur1 ="./gifs/try33-2_29.gif";
> //$kleur2 ="./gifs/try33-2_32.gif";
> //$kleur = ($i++ % 2) ? "$kleur1" : "$kleur2"; //aanpassen in config
> ?>
> <?php do {
> $tekst = substr(Maakop($row_newsleft['title']),0,25);?>
> <table <?php //echo "background=\"$kleur\""; ?> width="215" height="29"
> border="0" align="center" cellpadding="0" cellspacing="0">
> <td><table width="215" border="0" align="center" cellpadding="0"
> cellspacing="0">
> <tr>
> <td width="15" class="news"><div align="center"><img
> src="./gifs/pic_49.gif" width="8" height="8"></div></td>
> <td width="200" height="15" class="news"><a
> href="index.php?page=newsshow&id=<?php echo $row_newsleft['id'];
> ?>"><strong><?php echo $tekst ?></strong></a></td>
> </tr>
> </table>
> <table width="215" border="0" align="center" cellpadding="0"
> cellspacing="0">
> <tr>
> <td width="15" class="news"> </td>
> <td width="200" class="scene"><?php echo
> $row_newsleft['datesubmit']; ?> - <?php echo $row_newsleft['clanname'];
> ?></td>
> </tr>
> </table></td>
> </tr>
> </table>
> <table width="215" border="0" align="center" cellpadding="0"
> cellspacing="0">
> <tr>
> <td width="761"><div align="center"><img src="./gifs/pic_57.gif"
> width="212" height="3"></div></td> (SHOWS DOTTET LINE)
> </tr>
> </table>
> <?php }} while ($row_newsleft = mysql_fetch_assoc($newsleft)); ?>
> <?php
> mysql_free_result($newsleft);
> ?>
You *could* do the following:
Count the number of results from your database. (8 in your example)
Create a new variable:
++++++++++++++++++++++++++++++++++++++++++++++++++++++
++$outputted_headlines = 0;
do{
++$outputted_headlines;
if( ++$outputted_headlines < $number_of_returned_results )
{
$print_dots = true;
}
else
{
$print_dots = false;
};
// do all your own stuff
// and in the dotted line part, do this:
?>
<table width="215" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td width="761"><div align="center"><?php
if( $print_dots === true ){ echo '<div align="center"><img
src="./gifs/pic_57.gif"
width="212" height="3"></div>' };
?></div></td>
</tr>
</table>
<?php
}while
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Of course, the $number_of_returned_results variable corresponds with
the number
of results that are returned from your query.
Hope to've helped a fellow dutch bloke
Frizzle.
[Back to original message]
|