• I’m sure this is something dumb. Why doesn’t this work:

    include '../../../wp-blog-header.php';
    global $wpdb;
    auth_redirect();
    global $currentuser;
    get_currentuserinfo();
    $cron_key = get_option('cp_cron_auth_key');
    
    if ($_GET['k'] == $cron_key) {
    //      $query = "SELECT user_id FROM wp_usermeta WHERE meta_key='gender' AND user_id NOT IN (SELECT uid FROM wp_cubepoints WHERE type='newreg')";
            $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key='gender'";
            $array = $wpdb->get_results($query);
            $wpdb->print_error();
            $q = 0;
            foreach ($array as $user => $i) {
                    $q++;
            }
            printf(__("Finished.", $q));
    } else {
            die (__('No permission to view this file.'));
    }
    
    ?>

    When I browse to https://www.mysite.com/script.php?k=mykey it gives me this error:

    WordPress database error: []
    SELECT user_id FROM wp_usermeta WHERE meta_key='gender'

    Which, is not very descriptive. What am I doing wrong?

Viewing 1 replies (of 1 total)
  • Thread Starter merlinn31

    (@merlinn31)

    In an effort to sterilize my code and my example, I made it look like the include may not be correct due to “../../../”, but it actually is.

Viewing 1 replies (of 1 total)
  • The topic ‘MySQL interfacing’ is closed to new replies.