Delete Operation

Thread Solved

Join Date: Jun 2008
Posts: 142
Reputation: ishlux is an unknown quantity at this point 
Solved Threads: 0
ishlux ishlux is offline Offline
Junior Poster

Delete Operation

 
0
  #1
Jul 24th, 2008
Hi all, i have written delete operation.......but its not deleting...........here is the code.......can u explain me whats wrong

  1. <?
  2. session_start();
  3. include('database.php');
  4. $mailid1 = $_GET['mail_id'];
  5. session_register("mailid1");
  6. $query1="SELECT * FROM autoalto_mail where mail_id='".$mailid1."'";
  7. $result = mysql_query( $query1 );
  8.  
  9. while($row = mysql_fetch_array($result))
  10. {
  11. echo $row['subject'];
  12. }
  13. mysql_close();
  14. ?>
  15. </b></td>
  16. <td align="right" colspan="3" style="padding-left:5px;" class="headtitle">
  17. <a href="Contractor_reply.php"><b>Reply</b></a><span >/</span>
  18. <a href="contractor_mail_delete_action.php"><b>Delete</b></a><span>/</span>
  19. <a href="lll.html"><b>Next</b></a></td></tr>
  20. <tr><td><b><font size="2"><span style="color:005D95">From:</span></b>
  21. <?
  22. session_start();
  23. include('database.php');
  24. $mailid1 = $_GET['mail_id'];
  25. $query1="SELECT * FROM autoalto_mail where mail_id='".$mailid1."'";
  26. $result = mysql_query( $query1 );
  27.  
  28. while($row = mysql_fetch_array($result))
  29. {
  30. echo $row['From_user'];
  31. }
  32. mysql_close();
  33. ?>
  34. </b></td></tr>
  35. </table>
  36. </td></tr>
  37.  
  38. <tr><td>
  39. <?
  40. session_start();
  41. include('database.php');
  42. $mailid1 = $_GET['mail_id'];
  43. $query1="SELECT * FROM autoalto_mail where mail_id='".$mailid1."'";
  44. $result = mysql_query( $query1 );
  45. //echo mysql_num_rows($result) ;
  46. while($row = mysql_fetch_array($result))
  47. {
  48. echo $row['contents'];
  49. }
  50. mysql_close();
  51. ?>
  52. <?
  53. session_start();
  54. include('database.php');
  55. $mailid1 = $_GET['mail_id'];
  56. $query1="DELETE FROM autoalto_mail where mail_id='".$mailid1."'";
  57. $result = mysql_query( $query1 );
  58. //echo mysql_num_rows($result) ;
  59.  
  60. mysql_close();
  61. ?>
Last edited by Tekmaven; Jul 24th, 2008 at 3:23 am. Reason: Code tags
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 183
Reputation: lydia21 is an unknown quantity at this point 
Solved Threads: 5
lydia21 lydia21 is offline Offline
Junior Poster

Re: Delete Operation

 
0
  #2
Jul 24th, 2008
  1. $query1="DELETE FROM autoalto_mail where mail_id=$mailid1";
check out and reply
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: Delete Operation

 
0
  #3
Jul 24th, 2008
you didn't mention any id to delete :
  1. <a href="contractor_mail_delete_action.php"><b>Delete</b></a>

and print this: echo $_GET['mail_id']; in your contractor_mail_delete_action.php page .
Last edited by Shanti Chepuru; Jul 24th, 2008 at 3:05 am.
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 133
Reputation: vicky_rawat is an unknown quantity at this point 
Solved Threads: 17
vicky_rawat's Avatar
vicky_rawat vicky_rawat is offline Offline
Junior Poster

Re: Delete Operation

 
0
  #4
Jul 24th, 2008
Hi,

Can you tell, what is wrong with the delete operation, is it giving an error or what.

The syntex is correct.
You can print the sql syntex and then run the query in mysql directly.
Vivek Rawat
Keep solving complexities.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 142
Reputation: ishlux is an unknown quantity at this point 
Solved Threads: 0
ishlux ishlux is offline Offline
Junior Poster

Re: Delete Operation

 
0
  #5
Jul 24th, 2008
Hi its displaying the value.......echo $_GET['mail_id']; but its not deleting
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: Delete Operation

 
0
  #6
Jul 24th, 2008
first try in mysql with delete opration like:
  1. DELETE FROM autoalto_mail where mail_id=25

use the mail_id which is in your table....

if its work ,then notify me...
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 142
Reputation: ishlux is an unknown quantity at this point 
Solved Threads: 0
ishlux ishlux is offline Offline
Junior Poster

Re: Delete Operation

 
0
  #7
Jul 24th, 2008
This Contractor_mail_action_contents.php
  1. <?php
  2. session_start();
  3. include('database.php');
  4. $result = mysql_query("SELECT * FROM autoalto_mail" );
  5.  
  6. while($row = mysql_fetch_array($result))
  7. {
  8. ?>
  9. <tr>
  10. <td width="5%"></td>
  11. <td><? echo $row['From_user'];?>
  12. <td><a href="contractor_mail_action_contents.php?mail_id=<? echo $row['mail_id'];?>">
  13. <?echo $row['subject'];
  14. $subj=$row['subject'];
  15. session_register("subj");?> </a></td>
  16. <td><?echo $row['date']?></td>
  17. </tr>
  18. <tr>
  19. <td width="5%"></td>
  20. <td colspan="4" style="background-repeat: repeat-x;" background="images/dot.jpg" height="0" width="300"></td>
  21. </tr>
  22. <?
  23. }
  24. mysql_close();
  25. ?>
  26.  
  27.  
  28. <?
  29. session_start();
  30. include('database.php');
  31. $mailid1 = $_GET['mail_id'];
  32. echo $_GET['mail_id'];
  33.  
  34. $query1="SELECT * FROM autoalto_mail where mail_id='".$mailid1."'";
  35. $result = mysql_query( $query1 );
  36. //echo mysql_num_rows($result) ;
  37. while($row = mysql_fetch_array($result))
  38. {
  39. echo $row['contents'];
  40. }
  41. mysql_close();
  42. ?>
This is Contractor_mail_delete_action.php


  1.  
  2. <?php
  3. session_start();
  4. include('database.php');
  5. $result = mysql_query("SELECT * FROM autoalto_mail" );
  6.  
  7. while($row = mysql_fetch_array($result))
  8. {
  9. ?>
  10. <tr>
  11. <td width="5%"></td>
  12. <td><? echo $row['From_user'];?>
  13. <td><a href="contractor_mail_action_contents.php?mail_id=<? echo $row['mail_id'];?>">
  14. <?echo $row['subject'];
  15. $subj=$row['subject'];
  16. session_register("subj");?> </a></td>
  17. <td><?echo $row['date']?></td>
  18. </tr>
  19. <tr>
  20. <td width="5%"></td>
  21. <td colspan="4" style="background-repeat: repeat-x;" background="images/dot.jpg" height="0" width="300"></td>
  22. </tr>
  23. <?
  24. }
  25. mysql_close();
  26. ?>
  27.  
  28.  
  29. <?
  30. session_start();
  31. include('database.php');
  32. $mailid1 = $_GET['mail_id'];
  33. $query1="DELETE FROM autoalto_mail where mail_id='".$mailid1."'";
  34. $result = mysql_query( $query1 );
  35. //echo mysql_num_rows($result) ;
  36.  
  37. mysql_close();
  38. ?>

Its not deleting.........
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: Delete Operation

 
0
  #8
Jul 24th, 2008
please provide your database table....
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC