• Hi.
    I use wpdb to execute a simple query but when running it, return data of another query.
    my code :

    global $wpdb;

    $query = “SELECT serviceId,servicePersianName,serviceParentId FROM
    appsazhybrid_bookingSystem_services WHERE serviceParentId = %d”;
    // $wpdb->query($query52);
    $parent_list = $wpdb->get_results($wpdb->prepare($query,[0]));

    echo $wpdb->prepare($query,[0]);
    echo $wpdb->last_query;

    echo:

    SELECT serviceId,servicePersianName,serviceParentId FROM appsazhybrid_bookingSystem_services WHERE serviceParentId = 0

    SELECT post_id, meta_key, meta_value FROM mtappsite_postmeta WHERE post_id IN (2169) ORDER BY meta_id ASC

Viewing 1 replies (of 1 total)
  • Bunty

    (@bhargavbhandari90)

    Hi @ario92

    Try to rename variable $query to another.
    Also in prepare, try to add only 0 instead of [0].

    • This reply was modified 5 years, 8 months ago by Bunty.
Viewing 1 replies (of 1 total)

The topic ‘wpdb get_result execute another query’ is closed to new replies.