Link to home
Start Free TrialLog in
Avatar of Nathan Riley
Nathan RileyFlag for United States of America

asked on

PHP While Loop

In my while loop it puts the header to the tables after each username instead of just the first row.

while ($line= mysql_fetch_array($result))
	 {
	echo '<table border="1" bordercolor="#FFCC00" style="background-color:#FFFFCC" width="400" cellpadding="3" cellspacing="3">
	<tr>
		<td>Username</td>
		<td>Thread Count</td>
		<td>Post Count</td>
		<td>Points Total</td>
	</tr>
	</table>';
	echo '<table border="1" bordercolor="#FFCC00" style="background-color:#FFFFCC" width="400" cellpadding="3" cellspacing="3"> 
	<tr>
		<td>' . $line['author_name'] . '</td>
		<td>' . $line['thread_total'] . '</td>
		<td>' . $line['post_total'] . '</td>
		<td>' . (($line['post_total'] * $posts) + ($line['thread_total'] * $topics)) . '</td>
	</tr>
  	</table>';
	}

Open in new window


Also how can I make the columns line up like maybe a set width or something?
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial