Mudsaf Posted August 2, 2012 Share Posted August 2, 2012 Okay now my problem is that im trying to make "LINK" that does the GET method that i can use by isset. while ($row2 = mysql_fetch_array($result2)) {echo "Published: " . $row2['PostDate'];if ($_SESSION['AccountID']==$_GET['id']) {$statusid = $row2['StatusID'];$value1 = $_GET['remove'] . $row2['StatusID'];if (isset($value1)) {$query3 = "DELETE FROM status WHERE OwnerID='{$_SESSION['AccountID']}' AND StatusID='{$row2['StatusID']}'";$result3 = mysql_query($query3);}echo " | ";echo "<a href='" . $_SERVER['PHP_SELF'] . "?id=" . $_GET['id'] . "&remove" . $row2['StatusID'] . "'>Remove post</a>"; So that function deletes every single status updates since in while. If out while the $row2['statusid'] will be blank in query. Link to comment Share on other sites More sharing options...
justsomeguy Posted August 2, 2012 Share Posted August 2, 2012 That if statement is always true, you're checking if the variable is set right after you've set it. It's always going to be set. Link to comment Share on other sites More sharing options...
Mudsaf Posted August 3, 2012 Author Share Posted August 3, 2012 Yes but im wondering how i get the statement to be only true when the correct "Remove" button is pressed. It says this if i add it before / after code. while ($row2 = mysql_fetch_array($result2)) {echo "Published: " . $row2['PostDate'];if ($_SESSION['AccountID']==$_GET['id']) {$statusid = $row2['StatusID'];}echo " | ";echo "<a href='" . $_SERVER['PHP_SELF'] . "?id=" . $_GET['id'] . "&remove" . $row2['StatusID'] . "'>Remove post</a>";$value1 = $_GET['remove'] . $row2['StatusID'];if (isset($value1)) {$query3 = "DELETE FROM status WHERE OwnerID='{$_SESSION['AccountID']}' AND StatusID='{$row2['StatusID']}'";$result3 = mysql_query($query3); Link to comment Share on other sites More sharing options...
boen_robot Posted August 3, 2012 Share Posted August 3, 2012 The easier way is to simply change the name so that all of it is "remove", not "remove" plus the StatusID, i.e. "&remove=" . $row2['StatusID'] and then instead of $value1 = $_GET['remove'] . $row2['StatusID'];if (isset($value1)) { check the $_GET itself, i.e. if (isset($_GET['remove'])) { 1 Link to comment Share on other sites More sharing options...
Mudsaf Posted August 4, 2012 Author Share Posted August 4, 2012 Thanks man ur god to me! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now