Title: Problem when include wordpress page in external website
Last modified: August 21, 2016

---

# Problem when include wordpress page in external website

 *  [mansi37](https://wordpress.org/support/users/mansi37/)
 * (@mansi37)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/problem-when-include-wordpress-page-in-external-website/)
 * Hello,
 * I want to get the total number of posts from wordpress to my php website.
    So
   i use line require_once(‘c:/xampp/htdocs/wordpress/wp-blog-header.php’);
 * There was no problem when I connected my database using “**mysql_**“
 * But the problem arrives when I change the database connection string from **“
   mysql_”** to **“PDO”**.
 * I get **Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[42S02]:
   Base table or view not found: 1146 Table ‘WORDPRESS_DB.MY_TABLE’ doesn’t exist**
 * So In my website, instead of my connection string, it uses the wordpress databse
   connection string.
 * Please reply. How to solve this problem?
    Thanks.

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/problem-when-include-wordpress-page-in-external-website/#post-3641072)
 * If all you want is a post count, I would not load the WP environment with wp-
   blog-header.php. That is a lot of overhead for a mere post count.
 * Instead, connect to the WP database with PDO and run a count query on the posts
   table for records of post_type = ‘post’ AND post_status = ‘publish’

Viewing 1 replies (of 1 total)

The topic ‘Problem when include wordpress page in external website’ is closed to
new replies.

## Tags

 * [external website](https://wordpress.org/support/topic-tag/external-website/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/problem-when-include-wordpress-page-in-external-website/#post-3641072)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
