justsomeguy Posted April 21, 2009 Share Posted April 21, 2009 Does $sid actually hold the ID of the item you want to delete? You're telling the database to delete whatever matches $sid:$delete=mysql_query("DELETE from subject_replays WHERE id='$sid'");So you need to figure out if $sid contains the ID that you're actually trying to delete. Link to comment Share on other sites More sharing options...
masrawy Posted April 21, 2009 Author Share Posted April 21, 2009 $repidthis is the id of replaay Link to comment Share on other sites More sharing options...
masrawy Posted April 21, 2009 Author Share Posted April 21, 2009 do the code like that hi sirthis code you write it for delet subject beforei put it to delet replayif ($action == "delete_replly") {br(); br();echo "<center><font size=4 face=\"Traditional Arabic\"><b> حزف الرد </b></font></center>";br(); br();echo "<p align=right><font size=2 color=#FF0000><b> </b></font></p>";$result = mysql_query("SELECT mem_id FROM subject_replays WHERE id='{$repid}'");if ($row = mysql_fetch_assoc($result)){if ($row['mem_id'] == $memberid){$delete=mysql_query("DELETE from subject_replays WHERE id='$repid'");if($delete){echo "تم الحذف بنجاح";} else {echo "ليس لديك صلاحية هذا هذا الاعلان";}}else{echo "ليس لديك صلاحية لحزف الرد";}}else{echo "هذا الاعلان غير موجود ";}echo "<meta http-equiv=\"refresh\" content=\"0; URL=index.php\">";} Link to comment Share on other sites More sharing options...
masrawy Posted April 23, 2009 Author Share Posted April 23, 2009 no help sir Link to comment Share on other sites More sharing options...
justsomeguy Posted April 23, 2009 Share Posted April 23, 2009 What do you need help with? Is it deleting? Does $repid contain the ID you're trying to delete? Have you printed $repid or the query to check on them? We keep going over the same things. If it's not working, print everything out and figure out why it's not working. You don't need to wait for me to tell you that. Link to comment Share on other sites More sharing options...
masrawy Posted April 23, 2009 Author Share Posted April 23, 2009 no sirpleast write code to me Link to comment Share on other sites More sharing options...
masrawy Posted April 23, 2009 Author Share Posted April 23, 2009 i echo that sirecho $repid;echo $subjectid;the out print is11671=the replay id167=the subject idand that is write Link to comment Share on other sites More sharing options...
masrawy Posted April 23, 2009 Author Share Posted April 23, 2009 i found this sirif ($memberid ==""){}else {br();echo "<table width=95% bgcolor=$col2 height=25><tr><td align=center> <b><font color=#FFFFFF>الردود: $countrep</font></b> </td></tr></table>";br(); $asmemr_select = mysql_query ("SELECT * from subject_replays where subject_id='$advid' and active='1' order by id desc");$i=1;while($row55=mysql_fetch_array($asmemr_select)){ $repid = "$i"; $member_id = $row55[mem_id]; $replay = $row55[replay]; $date = $row55[date];$i++; $asmem_select = mysql_query ("SELECT * from members where id='$member_id' and active='1'"); while ($Row6=mysql_fetch_array($asmem_select)) { $name = $Row6 [name]; $country = $Row6 [country]; $email = $Row6 ;include ("template/style1/replay_form.tpl");} } if($rep == "1"){br(); br();echo "<table width=95% bgcolor=$col2><tr><td align=center> <b><font color=#FFFFFF>إضافة رد</font></b> </td></tr></table>";br(); Link to comment Share on other sites More sharing options...
justsomeguy Posted April 23, 2009 Share Posted April 23, 2009 Listen, I'm not going to keep writing code for you. We're 250 posts into this topic, and you should know how to do it by now. This is your delete code: $result = mysql_query("SELECT mem_id FROM subject_replays WHERE id='{$repid}'");if ($row = mysql_fetch_assoc($result)){ if ($row['mem_id'] == $memberid) { $delete=mysql_query("DELETE from subject_replays WHERE id='$repid'"); if($delete){echo "تم الحذف بنجاح";} else {echo "ليس لديك صلاحية هذا هذا الاعلان";} } else { echo "ليس لديك صلاحية لحزف الرد"; }}else{ echo "هذا الاعلان غير موجود ";} You should be able to debug that by adding statements to tell you what it's doing. It only deletes if $row['mem_id'] equals $memberid, so put some echo statements there so that you can tell if those two are equal. If they are equal, then it runs a delete query. Print the delete query out to see what it looks like, and run it on the database yourself to see if it deletes the record you're trying to delete.I can't do all of this for you. I don't have the time to do my job and your job, I only have the time to do my job. You need to learn how to do your job, no one else can do it for you. Link to comment Share on other sites More sharing options...
masrawy Posted April 24, 2009 Author Share Posted April 24, 2009 wher can i put this code sir Link to comment Share on other sites More sharing options...
masrawy Posted April 24, 2009 Author Share Posted April 24, 2009 and this code withh be like that ? <br> <a href="index.php?action=delete_subject&rep_id=<? echo $repid; ?>&subjectid=<? echo $subjectid; ?>" ><span lang="ar-eg">حـــذف</span></a></td> </tr> Link to comment Share on other sites More sharing options...
justsomeguy Posted April 27, 2009 Share Posted April 27, 2009 I don't know what you're asking me. The last code I posted is the code you're already using, not new code. Link to comment Share on other sites More sharing options...
masrawy Posted April 28, 2009 Author Share Posted April 28, 2009 <br><a href="index.php?action=delete_subject&rep_id=<? echo $repid; ?>&subjectid=<? echo $subjectid; ?>" ><span lang="ar-eg">حـــذف</span></a></td></tr>i main this code not delet the code you write i know becouse you write one like it beforei need the code if i puch go to the code you writelike that but for replay<br><a href="index.php?action=delete_subject&rep_id=<? echo $repid; ?>&subjectid=<? echo $subjectid; ?>" ><span lang="ar-eg">حـــذف</span></a></td></tr> Link to comment Share on other sites More sharing options...
justsomeguy Posted April 28, 2009 Share Posted April 28, 2009 The code there doesn't do the delete, it only prints the delete link. Make sure it's printing the right IDs into the link, and that it uses the right action, and add debugging code into the code for that action to print the IDs and make sure they came through right. Link to comment Share on other sites More sharing options...
masrawy Posted April 28, 2009 Author Share Posted April 28, 2009 i did but not deleted the replaay i need Link to comment Share on other sites More sharing options...
justsomeguy Posted April 28, 2009 Share Posted April 28, 2009 Did it delete a different one? Is the ID in the link that gets deleted the actual ID you're trying to delete? Link to comment Share on other sites More sharing options...
masrawy Posted April 28, 2009 Author Share Posted April 28, 2009 this is the code<br><a href="index.php?action=delete_subject&rep_id=<? echo $repid; ?>&subjectid=<? echo $subjectid; ?>" ><span lang="ar-eg">حـــذف</span></a></td>the id rightlook sirther is many subjectsevery subject have many reppliesi need now if i need to delet the repllay 1 frome the subject 100i go to the repplay and puch delet so it must be deletedbut now no Link to comment Share on other sites More sharing options...
justsomeguy Posted April 28, 2009 Share Posted April 28, 2009 OK, so when you look at the link to delete, does the link say that the rep_id is 1 and the subjectid is 100? In the code where $action == "delete_subject" (the link you show above has "delete_subject" as the action), is it getting the rep_id and the subjectid, and deleting the correct record in the database? Link to comment Share on other sites More sharing options...
masrawy Posted April 28, 2009 Author Share Posted April 28, 2009 delete_subjectthis is for subjects i write it like thatdelete_repllay Link to comment Share on other sites More sharing options...
justsomeguy Posted April 28, 2009 Share Posted April 28, 2009 OK, so does the link say "delete_subject" or "delete_repllay" on it? The word is actually "reply", with 1 "l", and no "a", but however you want to spell it I guess, as long as it's consistent. But all of the code you're posting shows that the link says "delete_subject" on it, it looks like it's trying to delete a subject instead of a reply.The point I'm trying to make is that you need to figure out which code the link is telling the PHP page to run, and then look at that code and figure out if it's doing what you're trying to do. Link to comment Share on other sites More sharing options...
masrawy Posted April 28, 2009 Author Share Posted April 28, 2009 if ($action == "delete_replly") {br(); br();echo "<center><font size=4 face=\"Traditional Arabic\"><b> حزف الرد </b></font></center>";br(); br();echo "<p align=right><font size=2 color=#FF0000><b> </b></font></p>"; $result = mysql_query("SELECT mem_id FROM subject_replays WHERE id='{$repid}'");if ($row = mysql_fetch_assoc($result)){ if ($row['mem_id'] == $memberid) { $delete=mysql_query("DELETE from subject_replays WHERE id='$repid'"); if($delete){echo "تم الحذف بنجاح";} else {echo "ليس لديك صلاحية هذا هذا الاعلان";} } else { echo "ليس لديك صلاحية لحزف الرد"; }}else{ echo "هذا الاعلان غير موجود ";}echo "<meta http-equiv=\"refresh\" content=\"0; URL=index.php\">";}and this is the code for delet icone<? $asmemr1_select = mysql_query ("SELECT * from ssubject where id='$ssub_id' and active='1'"); while ($Row515=mysql_fetch_array($asmemr1_select)) { $memberr_id = $Row515[mem_id]; $asmm_select = mysql_query ("SELECT * from members where id='$member_id' and active='1'"); while ($Row16=mysql_fetch_array($asmm_select)) { $special = $Row16 [special]; } }if ($special == "1" AND $mem_id == $memberid){?> <tr> <td colspan="2" bgcolor="<? echo $col1; ?>"> <p align="center"> <br> <a href="index.php?action=delete_subject&rep_id=<? echo $repid; ?>&subjectid=<? echo $subjectid; ?>" ><span lang="ar-eg">حـــذف</span></a></td> </tr> <? } else {}?> Link to comment Share on other sites More sharing options...
justsomeguy Posted April 28, 2009 Share Posted April 28, 2009 Well, it still looks like the link is telling it to delete a subject, not a reply. Look at the link. Link to comment Share on other sites More sharing options...
masrawy Posted April 28, 2009 Author Share Posted April 28, 2009 i chang it to<a href="index.php?action=delete_replly&rep_id=<? echo $repid; ?>&subjectid=<? echo $subjectid; ?>" ><span lang="ar-eg">حـــذف</span></a></td> </tr>print me this subject not found Link to comment Share on other sites More sharing options...
justsomeguy Posted April 28, 2009 Share Posted April 28, 2009 OK, so look at the code that runs for "delete_replly" and see why it would print that message. Link to comment Share on other sites More sharing options...
masrawy Posted April 28, 2009 Author Share Posted April 28, 2009 i see it good look SELECT mem_id FROM subject_replays WHERE id='{$repid}that is the thing make me look to you sir Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.