Jump to content

[SOLVED] putting data from database into html table...


Dragen

Recommended Posts

I'm trying to write some script that will get info from my table and put it into an html table.

 

		<table border="0" cellpadding="0" cellspacing="0" align="center" width="100%">
		<tr>
	<?php
	$result = mysql_query("SELECT * FROM booked");
	$no = 0;
	for($no = 0; $no <= 5; $no++){
		$row = mysql_fetch_array($result);
		  echo "\t\t<td align=\"center\">";
		  echo $row['day'] . " / " . $row['month'] . " / " . $row['year'];
		  echo "</td>\n";
		if($no == 5){
		echo "\t</tr>\n\t<tr>";
		}
	}
	?>
		</tr>
	</table>

This is what I've got so far, but it's not working...

What should happen is when it reaches 6 column across it starts on a new row. At the moment it's just putting the first six along the top and stopping..

I can't seem to get the code right to make it continue on another line...

note: yes I do mean 6 colums although it says $no <= 5;

This is because the first is counted as 0

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.