How do I use $wpdb?

I’m trying to add a voting system to my website which uses the CMS WordPress.

I suppose AJAX should be used and I have a template file and an external PHP file which accesses the database, but that obviously doesn’t work well.

Read More

I get this error:

“Call to undefined function add_action()”.

$wpdb probably can’t be used in an external PHP file.

How can I define $wpdb to be able to use it?

Related posts

Leave a Reply

1 comment