Advertisement
Guest User

Untitled

a guest
Dec 23rd, 2016
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. <?php
  2. if(!empty($_POST)){
  3. // prepare sql and bind parameters
  4. //Now they are being sanitized too!
  5. //You really don't need to create a variable for each one unless
  6. //you want to use it somewhere else on the page. You could just
  7. //use Input::get down in the array below
  8. $task_id = Input::get('task_id');
  9. $task_utilizator = Input::get('task_utilizator');
  10. $task_sub_descriere = Input::get('task_sub_descriere');
  11. $utilizator = Input::get('utilizator');
  12. $titluu = Input::get('titluu');
  13. $data_post = Input::get('data_post');
  14. $descriere = Input::get('descriere');
  15. $status_urgent = Input::get('status_urgent');
  16. $status_normal = Input::get('status_normal');
  17. $status_anulare = Input::get('status_anulare');
  18. $status_gata = Input::get('status_gata');
  19. $time_start = Input::get('time_start');
  20. $time_end = Input::get('time_end');
  21.  
  22. //Create an array of fields for your insert query
  23. $fields = array(
  24. 'task_id' => $task_id,
  25. 'task_utilizator' => $task_utilizator ,
  26. 'task_sub_descriere' => $task_sub_descriere,
  27. 'utilizator' => $utilizator,
  28. 'titluu' => $titluu,
  29. 'data_post' => $data_post,
  30. 'descriere' => $descriere,
  31. 'status_urgent' => $status_urgent,
  32. 'status_normal' => $status_normal,
  33. 'status_anulare' => $status_anulare,
  34. 'status_gata' => $status_gata,
  35. 'time_start' => $time_start,
  36. 'time_end' => $time_end
  37. );
  38.  
  39. //Run the insert.
  40. //to do an insert query, you only need to know what table and an array of fields. This creates, prepares, binds, and sanitizes your db update.
  41.  
  42. $db->insert('task_list_sub',$fields);
  43.  
  44. //here is the id of the above query
  45. $newTaskId = $db->lastId();
  46.  
  47. //Put your sub queries down here...
  48.  
  49.  
  50. //Then when you're done...
  51. Redirect::to('Location: account.php');
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement