Guest User

Untitled

a guest
Jan 29th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <?php
  2. ini_set('max_execution_time', 3000);
  3. $time_start = microtime(true);
  4. require("connect.php");
  5. $conn = mysqli_connect("127.0.0.1","root","psswd");
  6. mysqli_select_db($conn,"db_test");
  7. $results = mysqli_query($conn,"SELECT * FROM test");
  8. $i = 0;
  9. while ($row = mysqli_fetch_array($results,MYSQL_ASSOC)) {
  10. $post = array();
  11. $post['post_status'] = 'publish';
  12. $post['ID']=$row['idNew'];
  13. $post['post_date']=$row['date'];
  14. $post['post_date_gmt']=$row['date'];
  15. $post['post_content']=$row['body'];
  16. $post['post_title']=$row['title'];
  17.  
  18. $posts[$i] = $post;
  19. $i++;
  20. }
  21. mysqli_free_result($results);
  22. mysqli_close($conn);
  23.  
  24. require('C:xampphtdocstestwordpresswp-load.php');
  25. foreach ($posts as $post) {
  26. wp_insert_post($post);
  27. }
  28. echo '<br>Time elapsed: ' . (microtime(true) - $time_start);
  29. ?>
  30.  
  31. <?php
  32. $username = "root";
  33. $password = "psswd";
  34. $hostname = "127.0.0.1";
  35. $dbhandle = mysqli_connect($hostname, $username/*, $password*/)
  36. or die("Can not connect");
  37. echo "Conected";
  38. ?>
Add Comment
Please, Sign In to add comment