Visualizzazione 1 filone di risposte
Visualizzazione 1 filone di risposte
- Devi essere connesso per rispondere a questo topic.
Email: info@wpitaly.it
Home › Forum › Problemi Vari con WP › Errore visualizzazione ultime 10 post
Salve a tutti, è da un po di tempo che utilizzo il seguente codice per importarmi i titoli degli ultimi 10 post dal mio blog realizzato in WordPress ad un’altra mia pagina del sito in php:
<?php
$db= @mysql_connect(‘host’,’nome_utente’,’password’);
mysql_select_db(‘nome_db’ , $db);
$con = mysql_connect(“host”,”nome_utente”,”password”);
$sel_db = mysql_select_db(“nome_db”, $con);
$result = mysql_query(“select * FROM wp_posts WHERE post_type =’post’ ORDER BY id desc limit 10 ” ,$db);
while ($records = mysql_fetch_assoc($result)) {
echo “• “. $records .”<br>”;}
?>
Il tutto funziona correttamente, al momento invece su un blog di wordpress Versione 2.3 invece la cosa non va, restituendomi il seguente errore:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /web/htdocs/www.houseofgolf.it/home/index.php on line 62
Secondo voi è possibile che non funzioni con la versione 2.3 di WordPress questra stringa di PHP che utilizzo o l’errore sta altrove, ma dove???
Grazie a tutti
come non detto, problema risolto mi ero dimenticato di aver cambiato il prefisso WP con altre lettere perciò la query era errata perche non trovava nella tabell wp_post
Grazie a tutti
WPItaly - Copyright Creative Commons: CC BY-NC-SA 4.0