Guest User

Untitled

a guest
Mar 5th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.02 KB | None | 0 0
  1. <?php
  2.  
  3. $sql="";
  4.  
  5. $dbhost = "localhost";
  6. $user = "root";
  7. $password = "";
  8. $db = "wp";
  9.  
  10.  
  11. $conn = mysql_connect($dbhost,$user,$password);
  12. echo "[conn=$conn]<br>";
  13.  
  14.     $sql="select sid, catid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, ihome from wp.stories";
  15.  
  16.         if($conn){
  17.             $result = mysql_query($sql);
  18. echo "[result=$result]<br>";
  19.             $nb = mysql_num_rows($result);
  20. echo "[nb=$nb]<br>";
  21.  
  22.             while(list($sid, $catid, $aid, $title, $time, $hometext, $bodytext, $comments, $counter, $topic, $informant, $notes, $ihome) = mysql_fetch_row($result)) {
  23. echo "----------------------------------------------------------------------<br>";
  24.  
  25. $title = addslashes($title);
  26. echo "<br>title=$title<br>";
  27. $hometext = addslashes($hometext);
  28. echo "<br>hometext=$hometext<br>";
  29. $bodytext = addslashes($bodytext);
  30.  
  31. //echo "<br>hometext=$hometext<br>";
  32.           $sqlinsert="INSERT INTO `wp`.`wpfr_posts` (
  33.                        `ID` ,`post_author` ,`post_date` ,`post_date_gmt` ,`post_content` ,`post_title` ,`post_excerpt` ,`post_status` ,`comment_status` ,`ping_status` ,
  34.                        `post_password` ,`post_name` ,`to_ping` ,`pinged` ,`post_modified` ,`post_modified_gmt` ,`post_content_filtered` ,`post_parent` ,`guid` ,`menu_order` ,
  35.                        `post_type` ,`post_mime_type` ,`comment_count`
  36.                        )
  37.                        VALUES (
  38.                        $sid , 1, '$time', '$time', '$hometext <!--more--> $bodytext', '$title', '', 'publish', 'open', 'open', '', '', '', '', '$time', '$time', '', '0', '', '0', 'post', '', '0'
  39.                        );
  40.                        ";
  41. //          echo "<br>sqlinsert=[$sqlinsert]<br>";
  42.           $insert = mysql_query($sqlinsert);
  43.           echo "<br>insert=[$insert]<br>";
  44.             }
  45.  
  46.         if($result){
  47.           }else{
  48.             echo "<br>sql=$sql<br><br>";
  49.             echo "error mysql_query<br>";
  50.           }
  51.         }
  52.         else{
  53.             echo "<br>conn=$conn<br>";
  54.             echo "<br>sql=$sql<br>";
  55.             echo "error connect db";
  56.         }
  57.  
  58. ?>
Add Comment
Please, Sign In to add comment