Quantcast
Viewing all articles
Browse latest Browse all 5527

jolona on "How can I use data from a mysql wordpress data base?"

I need to show out of wordpress the title and date from a blog Wordpress mysql Data Base. How could I make the request? Could you give me an example?

I tried to do this but it doesn´t work (it is strange because with andother not-wordpress database it works well):

<?
//connect with database

$connect=mysql_connect("localhost","myuser","mypassword");

//select database

mysql_select_db("mydatabase",$connect);

//make querys

$result=mysql_query("select * from wp_posts order by fecha DESC limit 0,20", $connect);
$totalregistros=mysql_num_rows($result);

//print results in array

while($row=mysql_fetch_array($result))
{
echo $row[post_title];
echo "";
echo $row[post_date];
}
mysql_free_result($result)
?>

Thanks for your answer. I need help!!!


Viewing all articles
Browse latest Browse all 5527

Trending Articles