Click to See Complete Forum and Search --> : table help in php


davidjmorin
January 22nd, 2008, 04:21 PM
i have the following script and need help with some of the table work

id like to have the cells when new ones are added they go horizontal until they reach 4 colomns then drop down a row. how would i accomplish taht?

<?php
include 'config.php';
include 'opendb.php';

$query = "SELECT name, date, Email, message FROM contact";
$result = mysql_query($query);
echo '<table border="5" BORDERCOLORLIGHT=YELLOW BORDERCOLORDARK=BLUE bgcolor="#6699ff" width="200px"><tr><td>';
while($row = mysql_fetch_assoc($result))
{
echo '<tr>';
echo '<td>';
echo "Date : {$row['date']} <br>" .
"Name :{$row['name']} <br>" .
"Email : {$row['Email']} <br>" .
"Message : {$row['message']} <br><br>";
echo '</tr>';
echo '</td>';
}

echo '</table>';
include 'closedb.php';
?>
<html>
<body bgcolor="black">


</html>

PeejAvery
January 22nd, 2008, 05:12 PM
You have a lot of invalid HTML in there.

<html>
<body bgcolor="#000000">

<table border="5" bgcolor="#6699ff" width="200px">
<?php
include 'config.php';
include 'opendb.php';

$query = "SELECT name, date, Email, message FROM contact";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)){
?>
<tr>
<td><?php echo $row['date']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['Email']; ?></td>
<td><?php echo $row['message']; ?></td>
</tr>
<?php
}

include 'closedb.php';
?>
</table>

</body>
</html>

davidjmorin
January 22nd, 2008, 07:07 PM
hey im a noobie
bound to happen haha....

im doing well though.