Aravinthan
New Member
- Messages
- 68
- Reaction score
- 0
- Points
- 0
Hi,
I am making a personal website in which I show my teams and my recent hockey scores. So I made this code, that will insert the recent games in a table and update the players points table.:
form.php:
formprocess.php
And when I want to test it, I enter the numbers in the form.php file well but I get this error when I reach formprocess.php:
HTTP 500 Internal Server Error
Thanks for your help,
Ara
I am making a personal website in which I show my teams and my recent hockey scores. So I made this code, that will insert the recent games in a table and update the players points table.:
form.php:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd[/URL]">
<html xmlns="[URL]http://www.w3.org/1999/xhtml[/URL]">
<head>
<title>Aravinthan, Sivaneswaran</title>
<meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="../../style.css" media="screen" />
</head>
<body>
<div id="wrap">
<div id="header">
<h1><a href="#">Aravinthan Sivaneswaran</a></h1>
<h2>My Personal Website</h2>
</div>
<!-- Top Navigation -->
<?php include("../../include/topnav.php"); ?>
<!-- Top Navigation End -->
<!-- Conteant -->
<div id="content">
<div class="right">
<h2>Hockey</h2>
<br /><br />
<form method="post" action="formprocess.php">
<table>
<tr>
<td>
Game Number: <input type="text" name="gamenumber" maxlength="2" />
</td>
</tr>
<tr>
<td>
Goals For: <input type="text" name="gf" maxlength="2" size="5%" />
</td>
<td>
Goals Against: <input type="text" name="ga" maxlength="2" size="5%" />
</td>
</tr>
<tr>
<?php
$link = mysql_connect ("localhost", "stmaxel_ara", "*edited*")
or die("mysql_error()");
mysql_select_db ("stmaxel_stats", $link);
$result = mysql_query("SELECT fname, lname FROM `2008-2009` ",$link);
echo "<th align='center' BGCOLOR='#413326'><FONT COLOR='#FFFFFF' size='3'></font></th>
<th align='center' BGCOLOR='#413326'><FONT COLOR='#FFFFFF' size='3'>Name</font></th>
<th align='center' BGCOLOR='#413326'><FONT COLOR='#FFFFFF' size='3'>G</font></th>
<th align='center' BGCOLOR='#413326'><FONT COLOR='#FFFFFF' size='3'>A</font></th>
<th align='center' BGCOLOR='#413326'><FONT COLOR='#FFFFFF' size='3'>P</font></th>";
echo "</tr>";
while($row = mysql_fetch_array($result))
{
$lname = $row['lname'];
$fname = $row['fname'];
echo "<tr>";
echo "<td>";
echo "$lname, $fname:";
echo "</td>";
echo "<td>";
echo "<input type='text' name='$lname' value='$lname, $fname' readonly />";
echo "</td>";
echo "<td>";
echo "<input size='1%' type='text' name='$lnameg' maxlength='2'/>";
echo "</td>";
echo "<td>";
echo "<input size='1%' type='text' name='$lnamea' maxlength='2' />";
echo "</td>";
echo "<td>";
echo "<input size='1%' type='text' name='$lnamep' maxlength='2' />";
echo "</td>";
echo "</tr>";
}
?>
<tr>
<td>
<input type="submit" value="Submit" />
<input type="reset" value="Reset" />
</td>
</tr>
</table>
</form>
<br /><br />
Thanks for visiting my site and enjoy your stay,
Ara
</div>
<!-- Content End -->
<!-- Left Navigation -->
<?php include("../../include/leftnav.php"); ?>
<!-- Left Navigation End -->
<div style="clear: both;"> </div>
</div>
<div id="bottom"> </div>
<!-- Footer -->
<?php include("../../include/footer.php"); ?>
<!-- Footer End -->
</div>
</body>
</html>
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd[/URL]">
<html xmlns="[URL]http://www.w3.org/1999/xhtml[/URL]">
<head>
<title>Aravinthan, Sivaneswaran</title>
<meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="../../style.css" media="screen" />
</head>
<body>
<div id="wrap">
<div id="header">
<h1><a href="#">Aravinthan Sivaneswaran</a></h1>
<h2>My Personal Website</h2>
</div>
<!-- Top Navigation -->
<?php include("../../include/topnav.php"); ?>
<!-- Top Navigation End -->
<!-- Conteant -->
<div id="content">
<div class="right">
<h2>Hockey</h2>
<br /><br />
<?php
$link = mysql_connect ("localhost", "user", "pass") or die(mysql_error());
mysql_select_db("stmaxel_stats") or die(mysql_error());
$gameid = $_POST['gamenumber'];
$gf = $_POST['gf'];
$ga = $_POST['ga'];
$lname = $_POST['lname'];
$lnameg = $_POST['lnameg'];
$lnamea = $_POST['lnamea'];
$lnamep = $_POST['lnamep'];
if (gf > ga){
$winner = "Win";
}
else{
$winner = "Loss";
}
$sql="SELECT COUNT(*) AS count
FROM games
WHERE gameid='$gameid'";
$result=mysql_query($sql);
$row=mysql_fetch_assoc($result);
if ($row['count']>0){
echo "There is already a game with this id.";
}
else {
if (lnamep > 0){
mysql_query("INSERT INTO games (gameid, gf, ga, winner, lname, lnameg, lnameg, lnamep ) VALUES ('$gameid', '$gf', '$ga', '$winner', '$lname', '$lnameg', '$lnamea', '$lnamep')") or die(mysql_error());
print "Game $gameid has been successfully inserted into the database. Details:
Winner of the game: $winner<br/>
Scorers: $lname, $lnameg, $lnamea, $lnamep ";
$res = mysql_query("SELECT * FROM `2008-2009` WHERE lname='$lname' ",$link);
while($row = mysql_fetch_array( $res)) {
$goals = $lnameg + $row['goals'];
$assists = $lnamea + $row['assists'];
$point = $lnamep + $row['points'];
mysql_query("UPDATE `2008-2009` SET points='$point', gp='$gp', goals='$goals', assists='$assists' WHERE lname='$lname'") or die(mysql_error());
print " The players have been succesfuly updated. <a href='http://aravinthan.x10hosting.com/English/hockey/myteamscorers.php?sort=p'> View Scorers </a>";
}
}
}
?>
</div>
<!-- Content End -->
<!-- Left Navigation -->
<?php include("../../include/leftnav.php"); ?>
<!-- Left Navigation End -->
<div style="clear: both;"> </div>
</div>
<div id="bottom"> </div>
<!-- Footer -->
<?php include("../../include/footer.php"); ?>
<!-- Footer End -->
</div>
</body>
</html>
And when I want to test it, I enter the numbers in the form.php file well but I get this error when I reach formprocess.php:
HTTP 500 Internal Server Error
Thanks for your help,
Ara
Last edited by a moderator: