WordPress.org

Ready to get started?Download WordPress

Forums

$wpdb error but without description (2 posts)

  1. srkan
    Member
    Posted 6 years ago #

    I have the WordPress 2.5 installed in my server.

    I've inserted the following code in my template

    $getL1 = $wpdb->get_results("SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = 'nivelChamada' AND wpostmeta.meta_value = 'L1' AND wposts.post_status = 'publish' AND wposts.post_date <= NOW() ORDER BY wposts.post_date DESC LIMIT 1", OBJECT);

    but when I get a preview in template, I have the following error:

    WordPress database error: []
    SELECT wp.* FROM wp_posts AS wp, wp_postmeta AS wpm WHERE wp.ID = wpm.post_id AND wpm.meta_key LIKE 'nivelChamada' AND wpm.meta_value LIKE 'L1' AND wp.post_status LIKE 'publish' AND wp.post_date <= NOW() ORDER BY wp.post_date DESC LIMIT 1

    What can be it?

    I have the same query in the same template and in the same WordPress version (2.5) and it's working.

    Anyone can help me? Please?

    Tks

    Kan Ishigami

  2. srkan
    Member
    Posted 6 years ago #

    Sorry the correct code is the following:

    $getL1 = $wpdb->get_results("SELECT wp.* FROM $wpdb->posts AS wp, $wpdb->postmeta AS wpm WHERE wp.ID = wpm.post_id AND wpm.meta_key LIKE 'nivelChamada' AND wpm.meta_value LIKE 'L1' AND wp.post_status LIKE 'publish' AND wp.post_date <= NOW() ORDER BY wp.post_date DESC LIMIT 1", OBJECT);

    and the error is:

    WordPress database error: []
    SELECT wp.* FROM wp_posts AS wp, wp_postmeta AS wpm WHERE wp.ID = wpm.post_id AND wpm.meta_key LIKE 'nivelChamada' AND wpm.meta_value LIKE 'L1' AND wp.post_status LIKE 'publish' AND wp.post_date <= NOW() ORDER BY wp.post_date DESC LIMIT 1

Topic Closed

This topic has been closed to new replies.

About this Topic