Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP update

Status
Not open for further replies.

dagoat10

Programmer
Jun 3, 2010
74
US
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.

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?
 
all your conditionals are actually assignments. is that intended?

Code:
        if($ProNumb = "on") [red] //missing a == perhaps? [/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top