justsomeguy Posted April 28, 2009 Share Posted April 28, 2009 If that query is not finding a record, then $repid must not be set to the ID to search for. Have you printed $repid to see what it is? Does it have the same value as the ID on the URL? Link to comment Share on other sites More sharing options...
masrawy Posted April 28, 2009 Author Share Posted April 28, 2009 yes i echo $repidprinted 1that is right becouse this is the repllay numberand this is the linke whene i puch http://localhost/new/index.php?action=dele...p;subjectid=176 Link to comment Share on other sites More sharing options...
justsomeguy Posted April 28, 2009 Share Posted April 28, 2009 If this is the error:هذا الاعلان غير موجودThen that means it didn't find a record in the subject_replays table with the id of 1.If this is the error:ليس لديك صلاحية لحزف الردThen that means the mem_id field for the record in the database did not match the $memberid variable.If this is the error:ليس لديك صلاحية هذا هذا الاعلانThen that means the delete query had an error. Link to comment Share on other sites More sharing options...
masrawy Posted April 28, 2009 Author Share Posted April 28, 2009 this is the errorIf this is the error:هذا الاعلان غير موجود Link to comment Share on other sites More sharing options...
masrawy Posted April 29, 2009 Author Share Posted April 29, 2009 this is the table of subject_replaysidsubject_idmem_idreplaydateactive Link to comment Share on other sites More sharing options...
masrawy Posted April 29, 2009 Author Share Posted April 29, 2009 sir i see now the data on sql i found 1d =27subject_id=176mem_id=91and we all the time think id =1 ? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 29, 2009 Share Posted April 29, 2009 Check the code that prints the link to make sure it's printing the correct ID numbers there. Link to comment Share on other sites More sharing options...
masrawy Posted April 29, 2009 Author Share Posted April 29, 2009 How ? Link to comment Share on other sites More sharing options...
Synook Posted April 29, 2009 Share Posted April 29, 2009 What is showing you that data? Link to comment Share on other sites More sharing options...
masrawy Posted April 29, 2009 Author Share Posted April 29, 2009 ????????????????/ Link to comment Share on other sites More sharing options...
justsomeguy Posted April 29, 2009 Share Posted April 29, 2009 How is it possible that we're 15 pages into this topic and you still don't understand basic debugging?Look, here's the link you click to delete:<a href="index.php?action=delete_replly&rep_id=<? echo $repid; ?>&subjectid=<? echo $subjectid; ?>" ><span lang="ar-eg">حـــذف</span></a>It prints the variable $repid for rep_id, right? And the delete code gets rep_id and looks it up in the database, right? And it's the wrong ID, right? So figure out what $repid is getting set to in the link, and figure out why it's not the right ID. Find where it's coming from. Link to comment Share on other sites More sharing options...
masrawy Posted April 29, 2009 Author Share Posted April 29, 2009 i see that in index $ass11_select = mysql_query ("SELECT * from subject_replays where subject_id='$s_id' and active='1' order by id desc"); $countfs= mysql_num_rows($ass11_select); while ($Row41=mysql_fetch_array($ass11_select)) { $re_id = $Row41 [id]; $meme_id = $Row41 [mem_id]; $re_replay = $Row41 [replay]; $re_date = $Row41 [date];and this $as6_select = mysql_query ("SELECT * from subject_replays where subject_id='$sub_id' and active='1'"); $count= mysql_num_rows($as6_select);echo "<table width=95%><tr><td align=center bgcolor=#CFCFCF> الردود ($count) </td></tr></table>"; while ($Row1=mysql_fetch_array($as6_select)) { $r_id = $Row1 [id]; $s_id = $Row1 [subject_id]; $member_id = $Row1 [mem_id]; $replay = $Row1 [replay]; $date = $Row1 [date];i try $r_id for repllay but not work Link to comment Share on other sites More sharing options...
masrawy Posted April 30, 2009 Author Share Posted April 30, 2009 no help sir ? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 30, 2009 Share Posted April 30, 2009 I don't see where it's writing the delete link.Look at where it writes the delete link. You don't need to show it to me, just find it.When you find it, notice that it writes $rep_id and $subjectid into the link. Backtrack in the code and figure out where those are getting set. Link to comment Share on other sites More sharing options...
masrawy Posted April 30, 2009 Author Share Posted April 30, 2009 i really try and i caan't do iti try all things Link to comment Share on other sites More sharing options...
justsomeguy Posted April 30, 2009 Share Posted April 30, 2009 I'll give you a hint. The line starts with "$rep_id ="... If you can't find that line, that might be the problem. But it looks like it's getting set to 1 somewhere. Link to comment Share on other sites More sharing options...
masrawy Posted May 1, 2009 Author Share Posted May 1, 2009 i searsh in index fpr "$rep_id ="foundif ($action == "delete_subject") { $delete=mysql_query("DELETE from subject_replays WHERE id='$rep_id'"); if($delete){echo "تم الحذف بنجاح";} else {echo "هناك خطأ في عملية الحذف";}echo "<meta http-equiv=\"refresh\" content=\"2; URL=index.php?action=subject_disc&subjectid=$subjectid\">";}and this is for subjet ? Link to comment Share on other sites More sharing options...
justsomeguy Posted May 1, 2009 Share Posted May 1, 2009 I don't see where that contains "$rep_id=". Link to comment Share on other sites More sharing options...
masrawy Posted May 2, 2009 Author Share Posted May 2, 2009 this one in indexif ($action == "delete_subject") { $delete=mysql_query("DELETE from subject_replays WHERE id='$rep_id'"); if($delete){echo "تم الحذف بنجاح";} else {echo "هناك خطأ في عملية الحذف";}echo "<meta http-equiv=\"refresh\" content=\"2; URL=index.php?action=subject_disc&subjectid=$subjectid\">";}and this in repplay_form <br> <a href="index.php?action=delete_replly&rep_id=<? echo $rep_id; ?>&subjectid=<? echo $subjectid; ?>" ><span lang="ar-eg">حـــذف</span></a></td> </tr> Link to comment Share on other sites More sharing options...
masrawy Posted May 4, 2009 Author Share Posted May 4, 2009 ?????????????????????????? Link to comment Share on other sites More sharing options...
justsomeguy Posted May 4, 2009 Share Posted May 4, 2009 You're still not finding the right code. I don't know how else to describe this. You're trying to find where $rep_id is getting set. So you're looking for "$rep_id=", with or without a space before the equal sign. The code you're posting doesn't have those lines in it, and a bunch of question marks doesn't provide a lot of information. Link to comment Share on other sites More sharing options...
masrawy Posted May 13, 2009 Author Share Posted May 13, 2009 i really don't know the way to do that onlly i found this code in one place and i put it to you sir Link to comment Share on other sites More sharing options...
justsomeguy Posted May 13, 2009 Share Posted May 13, 2009 If you can't find the line, then that's probably the problem. Add this to the top of your code:$rep_id = isset($_GET['rep_id']) ? $_GET['rep_id'] : ''; Link to comment Share on other sites More sharing options...
masrawy Posted May 13, 2009 Author Share Posted May 13, 2009 you mean put it in index.php ?or in replay_form.tpl Link to comment Share on other sites More sharing options...
justsomeguy Posted May 13, 2009 Share Posted May 13, 2009 In the PHP code that processes the delete action. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.