I seem to be having a issue with my update statement in php
it is labeling everyone the same eventhough the checkboxes are check diffrently in the previous page.
what is the issue?
it is labeling everyone the same eventhough the checkboxes are check diffrently in the previous page.
Code:
$Column="Col";
$Number=1;
$ColNum = $Column . $Num;
$ColNums= $Column . $Number;
$DEBUG="ON";
while($Number < $Nums)
{
$ColNumb = $_POST["Col" . $Number];
$InjNumb = $_POST["Inj" . $Number];
$ProNumb = $_POST["P" . $Number];
$QuesNumb = $_POST["Q" . $Number];
$DoubtNumb = $_POST["D" . $Number];
$OutNumb = $_POST["O" . $Number];
if($ColNumb == "on" && $DEBUG=="ON")
{
echo $Number;
echo " " . $InjNumb;
echo " P " . $ProNumb;
echo " Q " . $QuesNumb;
echo " D " . $DoubtNumb;
echo " O " . $OutNumb;
echo "<br>";
}
if($ColNumb == "on")
{
/*
if($ProNumb = "on")
{
echo "pON";
$sql="UPDATE NFL_Injured set Injured=1, Injury='$InjNumb',
Probable=1 where ID=$Number";
mysql_query($sql);
mysql_error();
}*/
if($QuesNumb = "on")
{
echo "qON";
$sql="UPDATE NFL_Injured set Injured=1, Injury='$InjNumb',
Questionable=1 where ID=$Number";
mysql_query($sql);
mysql_error();
}
else if($DoubtNumb = "on")
{
echo "dON";
$sql="UPDATE NFL_Injured set Injured=1, Injury='$InjNumb',
Doubtful=1 where ID=$Number";
mysql_query($sql);
mysql_error();
}
else if($OutNumb = "on")
{
echo "oON";
$sql="UPDATE NFL_Injured set Injured=1, Injury='$InjNumb',
Out=1 where ID=$Number";
mysql_query($sql);
mysql_error();
}
}
else
{
$sql="UPDATE NFL_Injured set Injured=0, Injury='',
Probable=0, Questionable=0, Doubtful=0, Out=0 where ID=$Number";
mysql_query($sql);
mysql_error();
}
$Number++;
}
$query="Select * from NFL_Injured where Injured=1";
$data=mysql_query($query);
echo "<table border='2'>";
while($row = mysql_fetch_array($data))
{
echo "<tr>";
echo "<td>";
echo $row['Player'];
echo "</td>";
echo "<td>";
echo $row['Injury'];
echo "</td>";
if($row['Probable'] == 1)
{
echo "<td>";
echo "Probable";
echo "</td>";
}
if($row['Questionable'] == 1)
{
echo "<td>";
echo "Questionable";
echo "</td>";
}
if($row['Doubtful'] == 1)
{
echo "<td>";
echo "Doubtful";
echo "</td>";
}
if($row['Out'] == 1)
{
echo "<td>";
echo "Out";
echo "</td>";
}
echo "</tr>";
}
echo "</table>";
what is the issue?