Insert only selected result records in database

Reply

Join Date: Sep 2008
Posts: 33
Reputation: jyotiu is an unknown quantity at this point 
Solved Threads: 0
jyotiu jyotiu is offline Offline
Light Poster

Insert only selected result records in database

 
0
  #1
Apr 8th, 2009
Hi all,

I am getting result in an array from some webservice and i have created User Interface to see these results with each result have a check box with it.

what i want to do is to insert only that record in DB that user will check in check box.

Is there any way to do that.

  1. <tr>
  2. <td align='center'><input type='checkbox' name='chk0' value=''/></td>
  3. <td align='center'>1</td>
  4. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  5. <td align='center'>4</td>
  6. <td align='center'>100</td></tr>
  7. <tr>
  8. <td align='center'><input type='checkbox' name='chk1' value=''/></td>
  9. <td align='center'>66</td>
  10. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  11. <td align='center'>66</td>
  12. <td align='center'>40</td></tr>
  13. <tr>
  14. <td align='center'><input type='checkbox' name='chk2' value=''/></td>
  15. <td align='center'>99</td>
  16. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  17. <td align='center'>19</td>
  18. <td align='center'>167</td></tr>
  19. <tr>
  20. <td align='center'><input type='checkbox' name='chk3' value=''/></td>
  21. <td align='center'>6</td>
  22. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  23. <td align='center'>44</td>
  24. <td align='center'>555</td></tr>

User will check the check box against the record they want to insert in db and hit submit button.so all those records will go in db.there are four fields in Db table.

Thanks in advance.
jyotiu
Last edited by jyotiu; Apr 8th, 2009 at 10:41 am.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 239
Reputation: extofer is an unknown quantity at this point 
Solved Threads: 5
extofer's Avatar
extofer extofer is offline Offline
Posting Whiz in Training

Re: Insert only selected result records in database

 
0
  #2
Apr 8th, 2009
When you call the the Database, are you using a SELECT statement and a WHERE clause?? If so, what is it?
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 164
Reputation: rm_daniweb is an unknown quantity at this point 
Solved Threads: 10
rm_daniweb rm_daniweb is offline Offline
Junior Poster

Re: Insert only selected result records in database

 
0
  #3
Apr 9th, 2009
Originally Posted by jyotiu View Post
Hi all,

I am getting result in an array from some webservice and i have created User Interface to see these results with each result have a check box with it.

what i want to do is to insert only that record in DB that user will check in check box.

Is there any way to do that.

  1. <tr>
  2. <td align='center'><input type='checkbox' name='chk0' value=''/></td>
  3. <td align='center'>1</td>
  4. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  5. <td align='center'>4</td>
  6. <td align='center'>100</td></tr>
  7. <tr>
  8. <td align='center'><input type='checkbox' name='chk1' value=''/></td>
  9. <td align='center'>66</td>
  10. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  11. <td align='center'>66</td>
  12. <td align='center'>40</td></tr>
  13. <tr>
  14. <td align='center'><input type='checkbox' name='chk2' value=''/></td>
  15. <td align='center'>99</td>
  16. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  17. <td align='center'>19</td>
  18. <td align='center'>167</td></tr>
  19. <tr>
  20. <td align='center'><input type='checkbox' name='chk3' value=''/></td>
  21. <td align='center'>6</td>
  22. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  23. <td align='center'>44</td>
  24. <td align='center'>555</td></tr>

User will check the check box against the record they want to insert in db and hit submit button.so all those records will go in db.there are four fields in Db table.

Thanks in advance.
jyotiu


  1.  
  2. change your name='chk0'
  3.  
  4. into an array name=chk[]
  5.  
  6. call all the values from this code.
  7.  
  8. $chk=$_POST['chk'];
  9.  
  10. while (list ($key,$val) = @each ($chk)) {
  11. echo "$val,";
  12. }
  13.  
  14. you can manipulate your values for every checkbox.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
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