Jump to content

Recommended Posts

Right i`ll show you my problem first of all and explain whats wrong and what i want it to do :)

<?php if(strip_tags($_GET['d'])){
mysql_query("DELETE FROM search WHERE username='$username'");
echo "All searches deleted";
}

if(strip_tags($_GET['dl'])){
$check=mysql_num_rows(mysql_query("SELECT * FROM search WHERE id='$dl' AND username='$username'"));
if ($check !="0"){
mysql_query("DELETE FROM search WHERE id='$d'");
echo "Search deleted";
}}

?>

 

 

then

 

<table width="480" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor=black class=thinline>
          <tr> 
            <td  colspan="4" background="includes/grad.jpg"><center>
               Searches Out(<a href=?d=yes>Delete all</a>) </center></td>
          </tr>
          <tr bgcolor=white > 
            <td width="30%" height="6" bgcolor="#999999" class=tip>Target</td>
            <td width="31%" bgcolor="#999999" class=tip>Status</td>
            <td width="15%" bgcolor="#999999" class=tip>Delete</td>
          </tr>


          <?php $my=mysql_query("SELECT * FROM search WHERE username='$username'");
	 $humm=mysql_num_rows($my);
	 if ($humm == "0"){
	 echo "<tr> 
            <td height=5 colspan=4><center>No searches</center></td>
          </tr>";
	  }
	 while($i=mysql_fetch_object($my)){


	  echo "<tr>";
           echo " <td width=30% height=10><a href='profile.php?viewuser=$i->target'>$i->target</a></td>";
           echo " <td width=31%>"; if ($i->status == "0"){ echo "".maketime($i->time).""; }elseif ($i->status == "1"){ echo "Not found"; }else{ echo "<a Onclick=input($i->id) href=#send>Found</a>"; } echo "</td>";
echo "<td><a href='?dl=$i->id'>Delete</a></td>";
        echo "  </tr>";
	  }
	  ?>
</table>

 

 

Right the delete all works <a href=?d=yes>Delete all</a>

 

but i cant make it so it deletes them with there ids : <a href='?dl=$i->id'>Delete</a>

 

?? any help will be fine im :sd even if its a different way to do it im open to suggestions

 

Thank You

 

Link to comment
https://forums.phpfreaks.com/topic/211841-slightly-s-delete-row-id/
Share on other sites

i assume you mean

if(strip_tags($_GET['dl'])){
  $dl = (int)$_GET['dl'];
  $check=mysql_num_rows(mysql_query("SELECT * FROM search WHERE id='$dl' AND username='$username'"));
  if ($check !="0"){
    mysql_query("DELETE FROM search WHERE id='$dl'");
    echo "Search deleted";
  }
}

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.