Advertisement
Guest User

import

a guest
Feb 20th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. function import() {
  2. $templine = '';
  3. $lines = read_file(site_url('uploads/project.sql'));
  4. foreach ($lines as $line)
  5. {
  6. // echo $line;die();
  7.  
  8. // Skip it if it's a comment
  9. if (substr($line, 0, 2) == '--' || $line == '')
  10. continue;
  11.  
  12. // Add this line to the current templine we are creating
  13. $templine .= $line;
  14.  
  15. // If it has a semicolon at the end, it's the end of the query so can process this templine
  16. if (substr(trim($line), -1, 1) == ';')
  17. {
  18. // Perform the query
  19. $this->db->query($templine);
  20.  
  21. // Reset temp variable to empty
  22. $templine = '';
  23. }
  24. }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement