Ver Mensaje Individual
  #24 (permalink)  
Antiguo 29/11/2013, 06:48
martin_9_91
 
Fecha de Ingreso: mayo-2011
Ubicación: Bs.As Argentina
Mensajes: 193
Antigüedad: 13 años
Puntos: 3
Respuesta: Script Insert

Hace esto,

Código PHP:
Ver original
  1. <?php
  2.  
  3. $tabla = "wordpress";
  4. $servidor = "localhost";
  5. $usuario = "root";
  6. $clave = "";
  7. mysql_select_db($tabla,mysql_connect($servidor,$usuario,$clave)) or die("Error de conexión con la base de datos.");
  8. $consulta = mysql_query("Select sid, title, time, hometext, bodytext from nuke_stories");
  9. while($fila=mysql_fetch_array($consulta)){
  10. $sid = "'" . $fila['sid'] . "'";
  11. $title = "'" . $fila['title'] . "'";
  12. $time = "'" . $fila['time'] . "'";
  13. $hometext = "'" . $fila['hometext'] . "'";
  14. $body = "'" . $fila['bodytext'] . "'";
  15.  
  16. echo"$body";
  17. echo "<p>ID $sid fecha: $time noticia: $title</p>";
  18.  
  19. $sqlinsert="INSERT INTO wp_posts
  20. (ID, post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_content_filtered, post_parent, guid, menu_order, post_type, post_mime_type, comment_count)
  21. VALUES ($sid, '1', $time, $time, $hometext, $title,'', 'publish', 'open', 'open', '','','','', $time, $time,'', '0','', '0', 'post','', '0')";  
  22.  
  23. die($sqlinsert);
  24.  
  25. mysql_query ($sqlinsert)
  26. OR die(mysql_error() );
  27. }
  28. ?>

Ese te va a devolver el insert y eso pegalo en mysql.

Te va a dar un error.

Ahí te vas a dar cuenta como solucionarlo.