Im new to php and have been trying to set up a Fanatasy Football site! Ive set up a form where I can enter all the data, i.e. who played, scored,booked...etc!! However, it doesnt seem to be updating the database!
Here's the code:
----------------updatePlayers.html-------------------
<form method="post" action="process.php">
<INPUT NAME="Scored" TYPE="text" size=2><INPUT NAME="conceeded" TYPE="text" size=2><BR><BR>
<b>First XI</b><BR>
<SELECT name="first11" size=1>
<option selected value = 0>--Select Player 1--</option>
<option value = 1> BLAH</option>
<option value = 1> BLAH</option>
<option value = 1> BLAH</option>
</select><BR>
<SELECT name="first11" size=1>
<option selected value = 0>--Select Player 2--</option>
<option value = 1> BLAH</option>
<option value = 1> BLAH</option>
<option value = 1> BLAH</option>
// ....etc!!!
// also...
<b>Substitutes</b><BR>
<SELECT name="player12" size=1>
<option selected value = 0>--Select Player 12--</option>
<option value = 1> BLAH</option>
<option value = 1> BLAH</option>
// ...etc!
// have other drop downs for goals scored, discipline...etc.
---------------------process.php----------------------------
<?php
include("connect2db.php");
$getplayer = mysql_query("SELECT p_id FROM players WHERE p_id = $_POST['first11']");
$rows = mysql_fetch_array($getplayer);
// First Team
for($i = 0; $i < 11; $i++)
{
while($rows != 0)
{
$firstTeam = mysql_query("UPDATE players SET weekPts = weekPts + 3 WHERE p_id = $_POST['first11']");
}
}
// Subs
if($sub != 0)
{
for($j=0; $j<3; $j++)
{
$sub = mysql_query("UPDATE players SET weekPts = weekPts + 1 WHERE p_id = $_POST['sub']");
}
// this goes on for all scoring systems!!
?>
Why wont it update the database!? Am I missing out on something simple! As ive said before, scripting languages aren't my strong point!
All help much appreciated!