shorty3 Posted August 26, 2010 Share Posted August 26, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/211841-slightly-s-delete-row-id/ Share on other sites More sharing options...
MadTechie Posted August 26, 2010 Share Posted August 26, 2010 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"; } } Quote Link to comment https://forums.phpfreaks.com/topic/211841-slightly-s-delete-row-id/#findComment-1104208 Share on other sites More sharing options...
shorty3 Posted August 27, 2010 Author Share Posted August 27, 2010 LEGEND Quote Link to comment https://forums.phpfreaks.com/topic/211841-slightly-s-delete-row-id/#findComment-1104212 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.