brem13 Posted May 31, 2010 Share Posted May 31, 2010 im trying to get an if statement working but it doesnt seem to want to see if the get statement is equal to something $sent = $_GET['message']; if($sent=="sent") i also tried if($_GET['message']=="sent") neither work, any suggestions? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted May 31, 2010 Share Posted May 31, 2010 Try <?php if (isset($_GET['message']) && $_GET['message'] == 'sent') { // // do something // } ?> Ken Quote Link to comment Share on other sites More sharing options...
brem13 Posted May 31, 2010 Author Share Posted May 31, 2010 thank you, i tried that and still the same thing modified code to look like if (isset($_GET['message']) && $_GET['message'] == 'sent') mysql_query("DELETE FROM sent WHERE id = '$id' AND userto = '$userLoggedIn'"); else mysql_query("DELETE FROM messages WHERE id = '$id' AND userto = '$userLoggedIn'"); and the url is messages.php?id=4&message=sent&delPerm=yes Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted May 31, 2010 Share Posted May 31, 2010 At the top of your script put <?php echo '<pre>' . print_r($_GET,true) . '</pre>'; ?> This will show you the $_GET array. Ken Quote Link to comment Share on other sites More sharing options...
brem13 Posted May 31, 2010 Author Share Posted May 31, 2010 Array ( [id] => 4 [message] => sent [delPerm] => yes ) Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted May 31, 2010 Share Posted May 31, 2010 How do you know it's not working? If you change the "if" statement to be: <?php if (isset($_GET['message']) && $_GET['message'] == 'sent') { echo "is sent<br>\n"; } else { echo "is NOT sent<br>\n"; } ?> What is display? Ken Quote Link to comment Share on other sites More sharing options...
brem13 Posted May 31, 2010 Author Share Posted May 31, 2010 ok, it worked, i had my select statement trying to delete from the wrong field, sorry, and thanks again! Quote Link to comment 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.