Im trying to get a script running on my site. Its a simple standings script. In the members section i want them to be able to edit the standinds and for public viewed once updated it updates for public view as normal.
heres what i have file name:standedit.php
<table width="500">
<tr>
<td valign=top width=250><font size="3" face="tahoma"><br>Rank:<br>Won:<br>Lost:
</td>
<?
$query = "SELECT * FROM standings";
$qh = mysql_query($query);
if (!$qh) {
echo mysql_errno().": ".mysql_error()."<BR>";
} else {
while ($row = mysql_fetch_array($qh)) {
echo "<form method=post action=standupdater.php><td valign=top width=250><br><input type=text name=rank1 value=$row[rank]><BR><input type=text name=won1 value=$row[won]><BR><input type=text name=lost1 value=$row[lost]><br><BR><input type=submit value=Update>\n";
}
}
?>
</td></tr></table>
filename:standings.php
<?
$query = "SELECT * FROM standings";
$qh = mysql_query($query);
if (!$qh) {
echo mysql_errno().": ".mysql_error()."<BR>";
} else {
while ($row = mysql_fetch_array($qh)) {
echo "Rank: $row[rank]<br>Won: $row[won]<br>Lost: $row[lost]<br>Percent: $row[percent]%<br>Updated: $row[date]<br>";
}
}
?>
and filename:standupdater.php
<?
$percent1 = floor(($won1 / ($won1 + $lost1)) * 100);
$date1 = date ("n/d/Y");
$q = "update standings SET rank='$rank1',won='$won1',lost='$lost1',percent='$percent1',date='$date1'";
mysql_query($q);
$qh = mysql_query($q);
if (!$qh) {
echo mysql_errno().": ".mysql_error()."<BR>";
} else {
echo "Updated.\n";
}
?>
for some reason when i hit update i get a error on standupdater.php line 5 and 6 any idea? maybe can i limit this down to 2 files one for edit one for public view
??