Jump to content

Get Case selection problem


thefollower

Recommended Posts

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.