1.053 views
Is het mogelijk om bij een tabel alleen de onderste border-lijn zichtbaar te maken ? Zo ja, op welke manier?
STYLE="border-bottom: 1px black dotted; toe te voegen aan een <TR>. Het is de bedoeling dat er onder elke row een horizontale streep komt. Er worden gegevens gehaald uit een database waaruit de lijst is ontstaan.
<?php
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);
//includes
include('config.php');
include('dbcon.php');
echo '<b>Interne nummers op naam</b><br>';
// onderstaand de query
$query = mysql_query("SELECT naam, nummer, inlog, afdeling, groep FROM intern ORDER BY naam ASC");
// array vullen met resultaten
$array = array();
while($array[] = mysql_fetch_array( $query ));
// aantal kolommen die je wilt hebben
$kolommen = 2;
// dit is mysql_num_rows()
$max = mysql_num_rows($query);;
// aantal uitgerekende rijen
//$stap = ceil($max / $kolommen);
// vast aantal rijen
$stap = 78;
echo '<table BORDER="0" ALIGN="left" STYLE="font-size: 5.5pt;">
<td width="100"><b>Naam</b></td>
<td width="10"><b>Telnr.</b></td>
<td width="10"><b>Inlog</b></td>
<td width="150"><b>Afdeling</b></td>
<td width="10"><b>Groep</b></td>
<td width="5"></td>
<td width="100"><b>Naam</b></td>
<td width="10"><b>Telnr.</b></td>
<td width="10"><b>Inlog</b></td>
<td width="150"><b>Afdeling</b></td>
<td width="10"><b>Groep</b></td>
</tr>';
for($i=0; $i<$stap; $i++)
{
echo '<tr STYLE="font-size: 5.5pt; border-bottom: 1px black dotted;">';
for($j=0; $j<$kolommen; $j++)
{
if(($i + ($j * $stap)) < $max)
{
// hier moet je fetchen en de data neerzetten
$row2 = $array[$i + ($j * $stap)];
echo '<td width="100">' . $row2['naam'] . '</td>';
echo '<td width="10">' . $row2['nummer'] . '</td>';
echo '<td width="10">' . $row2['inlog'] . '</td>';
echo '<td width="150">' . $row2['afdeling'] . '</td>';
echo '<td width="10">' . $row2['groep'] . '</td>';
echo'<td width="5"></td>';
}
else
{
echo '<td width="100"> </td>';
echo '<td width="10"> </td>';
echo '<td width="10"> </td>';
echo '<td width="150"> </td>';
echo '<td width="10"> </td>';
echo'<td width="5"></td>';
}
}
echo '</tr>';
}
echo '</table>';
?>
Mr.Moe schreef op 13.05.2009 09:20Voeg een klasse toe aan je css bestand:
.borderrij{border-bottom: 1px dotted #000000}
en dan zet je die klasse op je <tr> tag
<tr class='borderrij'>
Volgens mij zou dat moeten werken.
<?php
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);
//includes
include('config.php');
include('dbcon.php');
echo '<b>Interne nummers op naam</b><br>';
// onderstaand de query
$query = mysql_query("SELECT naam, nummer, inlog, afdeling, groep FROM intern ORDER BY naam ASC");
// array vullen met resultaten
$array = array();
while($array[] = mysql_fetch_array( $query ));
// aantal kolommen die je wilt hebben
$kolommen = 2;
// dit is mysql_num_rows()
$max = mysql_num_rows($query);;
// aantal uitgerekende rijen
//$stap = ceil($max / $kolommen);
// vast aantal rijen
$stap = 78;
echo '<table ALIGN="left" STYLE="font-size: 5.5pt; border: 1px hidden;">
<tr>
<td width="100" STYLE="border-bottom: 2px solid black;"><b>Naam</b></td>
<td width="10" STYLE="border-bottom: 2px solid black;"><b>Telnr.</b></td>
<td width="10" STYLE="border-bottom: 2px solid black;"><b>Inlog</b></td>
<td width="150" STYLE="border-bottom: 2px solid black;"><b>Afdeling</b></td>
<td width="10" STYLE="border-bottom: 2px solid black;"><b>Groep</b></td>
<td width="5"></td>
<td width="100" STYLE="border-bottom: 2px solid black;"><b>Naam</b></td>
<td width="10" STYLE="border-bottom: 2px solid black;"><b>Telnr.</b></td>
<td width="10" STYLE="border-bottom: 2px solid black;"><b>Inlog</b></td>
<td width="150" STYLE="border-bottom: 2px solid black;"><b>Afdeling</b></td>
<td width="10" STYLE="border-bottom: 2px solid black;"><b>Groep</b></td>
</tr>';
for($i=0; $i<$stap; $i++)
{
echo '<tr>';
for($j=0; $j<$kolommen; $j++)
{
if(($i + ($j * $stap)) < $max)
{
// hier moet je fetchen en de data neerzetten
$row2 = $array[$i + ($j * $stap)];
echo '<td width="100" STYLE="border-bottom: 1px solid black;">' . $row2['naam'] . '</td>';
echo '<td width="10" STYLE="border-bottom: 1px solid black;">' . $row2['nummer'] . '</td>';
echo '<td width="10" STYLE="border-bottom: 1px solid black;">' . $row2['inlog'] . '</td>';
echo '<td width="150" STYLE="border-bottom: 1px solid black;">' . $row2['afdeling'] . '</td>';
echo '<td width="10" STYLE="border-bottom: 1px solid black;">' . $row2['groep'] . '</td>';
echo'<td width="5" STYLE="border-bottom: 1px solid black;"></td>';
}
else
{
echo '<td width="100"> </td>';
echo '<td width="10"> </td>';
echo '<td width="10"> </td>';
echo '<td width="150"> </td>';
echo '<td width="10"> </td>';
echo'<td width="5"></td>';
}
}
echo '</tr>';
}
echo '</table>';
?>
rick schreef op 13.05.2009 10:08Ik heb het voor elkaar. Ik heb de style geplaatst in de <TD>'s
rick schreef op 13.05.2009 10:12Ja klopt, maar ik dacht dat ie in de <TR> hem ook zal pakken, maar dat was niet het geval. Beetje dom misschien, maar ben nog maar een newbie dusjaa...