Same problem but different results
Posted: Wed May 16, 2007 11:25 am
Hi Again,
Right I'm started to get somewhere, i edited the code(slightly) as follows: but the problem is know that its outputting the table header twice, any suggestions, and its not outputting all the records from the database.
Burrito: Please use php tags when posting code in the forums
Right I'm started to get somewhere, i edited the code(slightly) as follows: but the problem is know that its outputting the table header twice, any suggestions, and its not outputting all the records from the database.
Code: Select all
<?PHP include 'opendb.php'; ?>
<?PHP
$query="SELECT * FROM Users";
$result=mssql_query($query);
$num=mssql_num_fields ($result);
//mysql_close();
?>
<form action="updated.php">
<table width="75%" border="0"><?PHP $i=0;
while ($i < $num) {
$UserInitials=mssql_result($result,$i,"UserInitials");
$UserID=mssql_result($result,$i,"UserID");
$UserName=mssql_result($result,$i,"UserName"); ?>
<tr>
<td width="16%"><strong>Username:</strong></td>
<td width="22%"><strong>User initials</strong></td>
<td width="62%"> </td>
</tr>
<tr>
<td><?php echo "$UserName";?></td>
<td><?php echo "$UserInitials";?></td>
<td><input type=radio name=UserID value=<?php echo "$UserID"; ?><?php
++$i;
}
?> </td>
</tr>
<tr>
<td colspan="3"><input type="Submit" value="Update"> <input type="reset" name="Reset" value="Reset"></td>
</tr>
</table>
</form>