Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have very few knowledge on oo php and databases, and I am simply trying to insert data in my wp_pagesvisites table but I am having some trouble with this error message.

This is my script:

        'Adresse_IP' => $ip,
        'Post_ID' => $id,
        'Timestamp' => $time

Thanks for helping!

share|improve this question

1 Answer 1

up vote 3 down vote accepted

$wpdb is a global variable. You have to take it into your function’s scope first …

global $wpdb;

… or access it per $GLOBALS


And I would use always lowercase keys; this is just a useful convention.

share|improve this answer
thanks toscho for all of your answers!! – user25893 Jan 18 '13 at 22:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.