Jump to content

Recommended Posts

ok so i have this problem , it wont delete the persons post  AKA BLAB here is the code , i want it to delete the specific blab that they want to delete , here is my code

<?php
if (isset($_SESSION['idx']) && $logOptions_id != $id){
$sql_blabs = mysql_query("SELECT id, mem_id, the_blab, blab_date FROM blabbing WHERE mem_id='$id' ORDER BY blab_date DESC LIMIT 20");

while($row = mysql_fetch_array($sql_blabs)){

$blabid = $row["id"];
$uid = $row["mem_id"];
$the_blab = $row["the_blab"];
$the_blab = ($activeLinkObject -> makeActiveLink($the_blab));
$blab_date = $row["blab_date"];
$convertedTime = ($myObject -> convert_datetime($blab_date));
    $whenBlab = ($myObject -> makeAgo($convertedTime));

			$blabberDisplayList .= '
		        <table style="background-color:#FFF; border:#999 1px solid; border-top:none;" cellpadding="5" width="100%">
				<tr>
				<td width="10%" valign="top">' . $blab_pic . '</td>
				<td width="90%" valign="top" style="line-height:1.5em;"><span class="greenColor textsize10">' . $whenBlab . ' <a href="profile.php?id=' . $uid . '">' . $username . '</a> said:</span><br />
            ' . $the_blab . ' </td>
            </tr></table>';

}}
if (isset($_SESSION['idx']) && $logOptions_id == $id){
$sql_blabs = mysql_query("SELECT id, mem_id, the_blab, blab_date FROM blabbing WHERE mem_id='$id' ORDER BY blab_date DESC LIMIT 20");
 {
$sqlDeleteBlabs = mysql_query("SELECT * FROM blabbing WHERE mem_id='$id' ORDER BY blab_date DESC LIMIT 50");
	while ($row = mysql_fetch_array($sqlDeleteBlabs)){
    $blad_id = $row["id"];
if (isset($_POST['deleteBtn'])) {
    foreach ($_POST as $key => $value) {
        $value = urlencode(stripslashes($value));
	if ($key != "deleteBtn") {
$Delete = mysql_query("DELETE FROM blabbing WHERE id='$blad_id' AND mem_id='$id'");
header("location: profile.php?id=$id");
}
}}}
}
while($row = mysql_fetch_array($sql_blabs)){

$blabid = $row["id"];
$uid = $row["mem_id"];
$the_blab = $row["the_blab"];
$the_blab = ($activeLinkObject -> makeActiveLink($the_blab));
$blab_date = $row["blab_date"];
$convertedTime = ($myObject -> convert_datetime($blab_date));
    $whenBlab = ($myObject -> makeAgo($convertedTime));

			$blabberDisplayList .= '
		        <table style="background-color:#FFF; border:#999 1px solid; border-top:none;" cellpadding="5" width="100%">
				<tr>
				<td width="10%" valign="top">' . $blab_pic . '</td>
				<td width="90%" valign="top" style="line-height:1.5em;"><span class="greenColor textsize10">' . $whenBlab . ' <a href="profile.php?id=' . $uid . '">' . $username . '</a> said:</span><br />
            ' . $the_blab . ' <input type="submit" name="Delete" id="$Delete" value="Delete" /></td>
            </tr></table>';
}}
?>

	$Delete = mysql_query("DELETE FROM blabbing WHERE id='$blad_id' AND mem_id='$id'");
header("location: profile.php?id=$id");

 

How do you know if this query succeeded or failed?

 

Also it's very strange that you have a loop over $_POST, and inside the loop you check if the key is NOT deleteBtn.  And then inside that you use two values $blad_id and $id which are not related to the key you found in $_POST at all.  I don't understand the logic of that.

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.