Re[2]: [PHP] Too many 'linespaces'
| From: | Tom Rogers | Date: | Tue, 28 Jan 2003 03:44:29 +0000 |
| Subject: | Re[2]: [PHP] Too many 'linespaces' | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133341@lists.php.net to get a copy of this message | ||
Hi,
Tuesday, January 28, 2003, 12:47:05 PM, you wrote:
LE> You mean to comment out the while sentence?
LE> A do-while-loop won't work without the while-part would it? Comments are
LE> suplements to understand the code, not needed for the code to work.
LE> Thanks anyway
LE> "Tom Rogers" <trogers@kwikin.com> skrev i melding
LE> news:5745208776.20030128123832@kwikin.com...
>> Hi,
>>
>> Tuesday, January 28, 2003, 12:24:21 PM, you wrote:
>> LE> Hello,
>>
>> LE> I present some content of a mysql-table in an html-table. When the
LE> query
>> LE> which collects the content contains few rows I get the amount of space
LE> I
>> LE> want between the output and the above content. But when I get for
LE> instance
>> LE> 60 rows, the printed result jumps down about 7 lines. I would like to
LE> have
>> LE> the same small gap between the result of the query and the above
LE> content.
>>
>> LE> The code is as follows:
>>
>> LE> ......snip.........
>>
>> LE> <table width="100%" cellpadding="0"
>> LE> class="alle">
>> LE> <tr>
>> LE> <td> <strong><?php echo
>> LE> $row_Recordset1['mModell'];
?>></strong>
>> LE> </td>
>> LE> <td align="right"> </td>
>> LE> </tr>
>>
>> LE> <tr>
>> LE> <td colspan="2">
>> LE> <?php
>> LE> //checks if there exists any rows
>> LE> if($totalRows_Recordset1 > 0) {
>> LE> ?>
>>
>> LE> <table width="70%" border="0">
>> LE> <tr>
>> LE> ..........around here the printed result jumps many rows down
>> LE> <td><strong>Kontonr.</strong></td>
>> LE> <td><strong>Delkontonr.</strong></td>
>> LE> <td><strong>Tekst</strong></td>
>> LE> <td><strong>Kostnad</strong></td>
>> LE> <td><strong>Enhet</strong></td>
>> LE> </tr>
>> LE> <tr><td colspan="5"></td></tr>
>> LE> <?php do {
>> LE> $kontonr = $row_Recordset1['mKontonr'];
>> LE> $delkontonr = $row_Recordset1['mDelkontonr'];
>> LE> if ($delkontonr == 0) { $strong = '<strong>'; $strong2 =
>> LE> '</strong>'; }
>> LE> else { $strong = ''; $strong2 = ''; }
>> LE> ?>
>> LE> <tr>
>> LE> <td><?php echo $strong .
>> LE> fjern_null($row_Recordset1['mHovedkonto']) . $strong2; ?></td>
>> LE> <td><?php echo $strong .
>> LE> $row_Recordset1['mDelkontonr'] . $strong2; ?></td>
>> LE> <td><?php echo $strong .
>> LE> $row_Recordset1['mKontotekst'] . $strong2; ?></td>
>> LE> <td><?php echo $strong .
>> LE> fjern_null($row_Recordset1['mKostnad']) . $strong2; ?></td>
>> LE> <td><?php echo $strong .
LE> $row_Recordset1['mEnhet'] .
>> $strong2; ?>></td>
>> LE> </tr>
>> LE> <!--<input name="modell" type="hidden"
LE> value="<?php
>> //echo $modell; ?>>">-->
>> LE> <input name="modellId" type="hidden"
>> LE> value="<?php
LE> echo
>> LE> $row_Recordset1['modellId']; ?>">
>> LE> <?php } while ($row_Recordset1 =
>> LE> mysql_fetch_assoc($Recordset1)); ?>
>> LE> </table>
>>
>>
>>
>> LE> <?php
>> LE> } //if($totalRows_Recordset1 > 0) {
>> LE> ?>
>> LE> </td>
>> LE> </tr>
>> LE> </table>
>>
>> LE> ...... and so on ............
>>
>>
>> LE> When the query returns 60 rows I get ca. 7 blank lines between <?php
LE> echo
>> LE> $row_Recordset1['mModell']; ?> and Kontonr.
>>
>> LE> Does anyone understand? Anyone have a tip?
>>
>> LE> Thanks a lot!
>>
>> LE> Lars
>>
>>
>>
>>
>> maybe this line needs changing <?php } while ($row_Recordset1 =
LE> mysql_fetch_assoc($Recordset1)); ?>
>> to:
>> <?php }// while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
>>
>> I think you need the comment
>>
>> --
>> regards,
>> Tom
>>
True :) I missed the do bit , doing it that way means it will print out empty
values for the first run. You should make it a normal while loop or at least
fetch the first row before hitting the loop.
--
regards,
Tom