Guest User

Untitled

a guest
May 14th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. /*************************************************************************************
  2. main index.php file using jquery method
  3. /*************************************************************************************
  4. $('a.add').live("click",function() {
  5. $.ajax({
  6. type: 'get',
  7. url: 'record-insert.php',
  8. data: 'ajax=2&insert=' + $('#ins_job').attr("value"),
  9. success: function(e) {
  10. var parent = $("div:last").parent();
  11. parent.append('<div class="record" id="record'+e+'"><a href="#" class="delete">delete</a><strong>' + $('#ins_job').attr("value") + '</strong></div>');
  12. }
  13. });
  14. return false;
  15. });
  16.  
  17. /*************************************************************************************
  18. record-insert.php
  19. /*************************************************************************************
  20.  
  21. <?php
  22.  
  23. include('./intranet/lib/conf/dbconnect.php');
  24.  
  25. if(isset($_GET['insert']))
  26. {
  27. $result1 = oci_parse($conn,"SELECT MAX(JOB_ID) maxid FROM eo_jobtitle");
  28. oci_execute($result1);
  29. $max_row=oci_fetch_array($result1);
  30. $max_id=$max_row['MAXID'] + 1;
  31. echo $max_id;
  32. $result2 = oci_parse($conn,"INSERT INTO eo_jobtitle(JOB_ID,JOB_NAME,JOB_LEVEL) VALUES(".$max_id.",'".$_GET['insert']."',1 )");
  33. oci_execute($result2);
  34. }
  35.  
  36. ?>
Add Comment
Please, Sign In to add comment