I found a wtf... literally



  • stumbling through other people's code, i found this little gem with a wonderful comment, presumably left by another hapless coder...


    $sql = "INSERT INTO myTable (field1, field2, field3) "
          . "VALUES ('$username', '$course', NOW())";
    $result = mysql_query($sql);

    if ($result) {
        echo "<div align="center">Upload Successful</div>";
    } else {
        // shouldn't this be an error message??? wtf?!?
        echo "
        <table align=center border=1 bordercolor=red cellpadding=10 cellspacing=0>
        <tr>
            <td><b>Note</b>: Upload was successful.</td>
        </tr>
        </table>";
    }



  • if true
       then success

    else
       success

     

    Awesome logic.



  • if (true)
        doSomething();
    else if (false)
        ...
    else
        profit();



  • The Real WTF is of course that he is outputting raw HTML instead of using a template...
    <font size="2">
    (phew... thank you missing subject, you saved me from the evil post button...)</font>



  • @PSWorx said:

    The Real WTF is of course that he is outputting raw HTML instead of using a template...


    And a table with exactly one cell in it, no less.



  • Maybe the original programmer's boss said "I don't want to see any errors!"



  • @R.Flowers said:

    Maybe the original programmer's boss said "I don't want to see any errors!"

    <Programmer>Oh, yes sir! You won't ever see an error, sir, I swear sir! Don't beat me massa! <Leaves person="boss" />Oh, no, you won't see any errors, "sir".... MUAHAHAHAHAHAAHAHAHAHAHAAHAHAHAHAHAAHAHA*cough*hack*spleenasplode*</Programmer>


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.