Bullet Posted August 21, 2008 Share Posted August 21, 2008 <td class="TableArea"><div align="center"><a href='kill.php?delete=$buttock->id'>Delete</a></td> Thats the link to delete the search. PHP: if (strip_tags($_GET['delete'])){ mysql_query("DELETE id FROM search WHERE id='$buttock->id'"); echo "You deleted the search."; } When I click on the link it says "You deleted the search." But it doesn't, help? Link to comment https://forums.phpfreaks.com/topic/120695-solved-deleting-seperately/ Share on other sites More sharing options...
Mchl Posted August 21, 2008 Share Posted August 21, 2008 DELETE FROM search WHERE id='$buttock->id' http://dev.mysql.com/doc/refman/5.0/en/delete.html Link to comment https://forums.phpfreaks.com/topic/120695-solved-deleting-seperately/#findComment-621919 Share on other sites More sharing options...
Bullet Posted August 21, 2008 Author Share Posted August 21, 2008 I found 1 problem: <td class="TableArea"><div align="center"><a href='kill.php?delete=<? echo"$buttock->id"; ?>'>Delete</a></td> Now it shows what ID it is. But it still doesn't delete. Link to comment https://forums.phpfreaks.com/topic/120695-solved-deleting-seperately/#findComment-621920 Share on other sites More sharing options...
budimir Posted August 21, 2008 Share Posted August 21, 2008 The problem is in your kill.php. Can you post that code? Link to comment https://forums.phpfreaks.com/topic/120695-solved-deleting-seperately/#findComment-621993 Share on other sites More sharing options...
Bullet Posted August 21, 2008 Author Share Posted August 21, 2008 <td class="TableArea"><div align="center"><a href='kill.php?delete=<? echo"$buttock->id"; ?>'>Delete</a></td> That? Link to comment https://forums.phpfreaks.com/topic/120695-solved-deleting-seperately/#findComment-622040 Share on other sites More sharing options...
Bullet Posted August 21, 2008 Author Share Posted August 21, 2008 Anyone? ??? Link to comment https://forums.phpfreaks.com/topic/120695-solved-deleting-seperately/#findComment-622129 Share on other sites More sharing options...
Mchl Posted August 21, 2008 Share Posted August 21, 2008 Can you show us kill.php code? Link to comment https://forums.phpfreaks.com/topic/120695-solved-deleting-seperately/#findComment-622130 Share on other sites More sharing options...
Bullet Posted August 21, 2008 Author Share Posted August 21, 2008 $s_query=mysql_query("SELECT * FROM search WHERE username='$username' ORDER by id DESC"); $numeros=mysql_num_rows($s_query); if (strip_tags($_GET['delete'])){ mysql_query("DELETE FROM search WHERE id='$buttock->id'"); echo "You deleted the search."; } <? while($buttock = mysql_fetch_object($s_query)){ ?> <td class="TableArea"><div align="center"><a href='kill.php?delete=<? echo"$buttock->id"; ?>'>Delete</a></td> Not these are not together, I got the information which is linked to the deletion. Link to comment https://forums.phpfreaks.com/topic/120695-solved-deleting-seperately/#findComment-622137 Share on other sites More sharing options...
Bullet Posted August 21, 2008 Author Share Posted August 21, 2008 I can't find a way, I'm sure you PHP coders have a diferent style which will work Link to comment https://forums.phpfreaks.com/topic/120695-solved-deleting-seperately/#findComment-622163 Share on other sites More sharing options...
BlueSkyIS Posted August 21, 2008 Share Posted August 21, 2008 to help see the problem, echo your SQL statements: $sql = "DELETE FROM search WHERE id='$buttock->id'"; echo "sql: $sql<BR>"; mysql_query($sql) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/120695-solved-deleting-seperately/#findComment-622175 Share on other sites More sharing options...
Bullet Posted August 21, 2008 Author Share Posted August 21, 2008 Now it says: sql: DELETE FROM search WHERE id='' Doesn't say the ID even though when I hover over delete on the site it says the ID. Link to comment https://forums.phpfreaks.com/topic/120695-solved-deleting-seperately/#findComment-622179 Share on other sites More sharing options...
BlueSkyIS Posted August 21, 2008 Share Posted August 21, 2008 what happens in the browser window may have little to nothing to do with what happens on the server. ignore what the button says. the point is that the id isn't set in the code where you expect it to be. the problem is that you are invoking $buttock before $buttock is created. $buttock is created here, but you use it before here: while($buttock = mysql_fetch_object($s_query)){ Link to comment https://forums.phpfreaks.com/topic/120695-solved-deleting-seperately/#findComment-622187 Share on other sites More sharing options...
Bullet Posted August 21, 2008 Author Share Posted August 21, 2008 True, I thought about it before but didn't try it like an idiot, anyway, thanks I've fixed Link to comment https://forums.phpfreaks.com/topic/120695-solved-deleting-seperately/#findComment-622191 Share on other sites More sharing options...
BlueSkyIS Posted August 21, 2008 Share Posted August 21, 2008 very good. you were doing things $buttock backwards. Link to comment https://forums.phpfreaks.com/topic/120695-solved-deleting-seperately/#findComment-622196 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.