thefollower Posted October 31, 2007 Share Posted October 31, 2007 I'm not sure if i got my case correct but I got a Get link which runs through a case but one link does one thing the other does something else even though they should be both doing the same action this is what i have firstly: <div id="bv_" style="position:absolute;left:686px;top:686px;width:50px;height:48px;z-index:40" align="left"> <font style="font-size:13px" color="#FFFFFF" face="Arial"><br> <a href="reportletters.php?report=2">Report</a></font></div> <div id="bv_" style="position:absolute;left:686px;top:836px;width:50px;height:48px;z-index:30" align="left"> <font style="font-size:13px" color="#FFFFFF" face="Arial"><br> <a href="reportletters.php?report=3">Report</a></font></div> This is the Get Links. Then i have: if(isset($_GET['report'])){ switch($_GET['report']){ case '1': $MessageID = $rowone['MessageID']; $Update = "UPDATE messages SET Status = '3' WHERE MessageID='$MessageID'"; $result = mysql_query($Update) or die(mysql_error()); break; case '2': $MessageID = $rowtwo['MessageID']; $Update = "UPDATE messages SET Status = '3' WHERE MessageID='$MessageID'"; $result = mysql_query($Update) or die(mysql_error()); break; case '3': $MessageID = $rowthree['MessageID']; $Update = "UPDATE messages SET Status = '3' WHERE MessageID='$MessageID'"; $result = mysql_query($Update) or die(mysql_error()); default: die ("invalid message selected"); break; } } Now what happens is if i do report=2 on the GET then nothing happens (Which is correct as there is no message 2 in this situation) But if i do report=3 it gives me the "Invalid message selected" even though there is no message 3 either.. so what it should be doing is basically nothing rather than producing error... What i dont get is why 2 doesn't yet 3 does... is it because the default is below 3? Or something? Quote Link to comment https://forums.phpfreaks.com/topic/75555-get-case-selection-problem/ Share on other sites More sharing options...
rajivgonsalves Posted October 31, 2007 Share Posted October 31, 2007 you forgot the break case '3': $MessageID = $rowthree['MessageID']; $Update = "UPDATE messages SET Status = '3' WHERE MessageID='$MessageID'"; $result = mysql_query($Update) or die(mysql_error()); break; default: die ("invalid message selected"); break; Quote Link to comment https://forums.phpfreaks.com/topic/75555-get-case-selection-problem/#findComment-382236 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.