I want to output two types of data in a mysql table. Courses that have been added, and courses that have been cancelled. I've stored the data in a mysql table using the following structure:
ID INFO ADDDEL
ID is the primary key
INFO is a varchar column which contains the course information
ADDDEL is either "a" for added or "d" for delete.
I want to output the table in two columns, one for all the "a"s and one for all the "d"s. How do I do that and make the columns come out neat and not broken up? For example:
a d
a d
a
a
Thanks.
Formatting php output to table columns
Moderator: General Moderators
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
Something like:
Code: Select all
<table>
<tr>
<td width="100">
Column 1
</td>
<td width="100">
Column 2
</td>
</tr>
<?php
$result = mysql_query('SELECT * FROM blah');
while($row = mysql_fetch_assoc($result)){
echo "<tr><td>".$row['hello']."</td><td>".$row['boo']."</td></tr>";
}
?>
</table>