Jump to content

Isset GET remove


Mudsaf

Recommended Posts

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

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

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'])) {

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...