Click to See Complete Forum and Search --> : No records showing - Echoing data from DB


scottyrob
09-07-2006, 04:28 PM
Hi there. Heres my code



<?php require("index_top.php"); require("index_left.php"); ?>

<?php echo "<div class=\"caption\">Awards Admin</div><br><br>"; ?>

Add a new award below<br><br><br><br><br><br>



<?php

require("files/db_connect.php");

$result = @mysql_query("SELECT * FROM Awards WHERE ID = ".$_GET["ID"]);

while ($row = mysql_fetch_assoc($result))


?>

<form name="form1" method="post" action="">
<table width="571" border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td><div align="right">ID:</div></td>
<td><div align="center">
<input type="text" name="textfield2" value="<? echo $row['ID'] ?>">
</div></td>
</tr>
<tr>
<td><div align="right">Image URL: </div></td>
<td><div align="center">
<input type="text" name="textfield3" value="<? echo $row['Image'] ?>">
</div></td>
</tr>
<tr>
<td><div align="right">URL Of Image when Clicked: </div></td>
<td><div align="center">
<input type="text" name="textfield4" value="<? echo $row['Image_URL'] ?>">
</div></td>
</tr>
<tr>
<td><div align="right">Badge Name: </div></td>
<td><div align="center">
<input type="text" name="textfield6" value="<? echo $row['Name'] ?>">
</div></td>
</tr>
<tr>
<td><div align="right">Badge Info:</div></td>
<td><div align="center">
<input type="text" name="textfield5" value="<? echo $row['Info'] ?>">
</div></td>
</tr>
<tr>
<td><div align="right">Badge Awarded To:</div></td>
<td><div align="center">
<input type="text" name="textfield7" value="<? echo $row['People'] ?>">
</div></td>
</tr>
</table>
</form>

<?php require("index_right.php"); require("index_bottom.php"); ?>


www.loddonexplorers.co.uk/New/awards_edit.php?ID=30

No record is showing though, even though there is information for ID=30

Scott

DJsAC
09-07-2006, 04:34 PM
most likely the server doesn't support the <? shorthand tag, because
<? echo $row['ID'] ?> is invalid and should give an error that you're missing the ';' .
<?php echo $row['ID']; ?> should work

The while loop should also have { and } surrounding the looped part...

boeing747fp
09-07-2006, 10:24 PM
get rid of while($row= and just set $row= if you only have 1 result.
and yea ^^ what that person wrote :P