Posted by "Anasta" on 12/18/05 10:21
The first script works ' modify_values.php' showing the values and a modify
link next to each but the next script it parses to 'modify_values2.php' is
obviously not working. I have tried to modify it from another script and
cant get it to pass the correct variables-- it always shows the first row in
the database . Any help appreciated.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modify_values.php
<?php
include("connect.php");
$sql = "Select * from leaderboard";
$result = mysql_query($sql);
?>
<br>
<br>
<body bgcolor="#FFFFFF" text="#666666" link="#666666">
<table width="461" border="1" align="center" cellpadding="2" cellspacing="0"
bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<tr>
<td width="206" height="25" align="center" bordercolor="#FFFFFF" ><div
align="left"><b>Title</b></div></td>
<td width="165" align="center" bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div
align="left"><b>Rating</b></div></td>
<td width="70" align="center" bordercolor="#FFFFFF" bgcolor="#FFFFFF"></td>
</tr>
<?php
while ($myrow = mysql_fetch_array($result)) {
echo "<tr><td>" . $myrow['Name'] . "</td>";
echo "<td>" . $myrow['Rating'] . "</td>";
echo "<td bgcolor='cyan'> <a href='modify_values2.php?id=" . $myrow['ID'] .
"'>Modify</a></td></tr>";
}
?>
</table>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modify_values2.php
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<?php
include("connect.php");
$sql = "Select * from leaderboard ";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$Name = $myrow['Name'];
$Rating = $myrow['Rating'];
?>
<form name="form1" method="POST" action="update_values.php">
<center>
<table border="1">
<tr>
<td><b>Title</b></td>
<td> <INPUT TYPE=TEXT SIZE="50" NAME="Name" VALUE="<?php echo
$Name;?>">
</td>
</tr>
<tr>
<td><b>Rating</b></td>
<td> <INPUT TYPE=TEXT SIZE="50" NAME="Rating" VALUE="<?php echo
$Rating;?>">
</td>
</tr>
</table>
</center>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<br><center><input type="submit" name="Update" value="Update"> <input
type="submit" name="Delete" value="Delete"></center>
</form>
</body>
</html>
[Back to original message]
|