Почему мой код запроса базы данных не работает в PHP 7.3? Но он отлично работает в php7 .0 - PullRequest
0 голосов
/ 06 февраля 2020

Почему мой код запроса базы данных не работает в PHP 7.3? Но он отлично работает в php7 .0.

. Это часть кода, которую я сейчас использую, надеюсь получить вашу помощь

function is_page_activity_all_amount(){
    if( ( $cache = get_transient( 'activity_list' ) ) !== false ) return $cache;
    $value = ''; 
        global $wpdb;
    $all_amount=$wpdb->prepare("select count(*) as total from(
    select ID as nid,comment_count as cid,post_author as uid,post_title as title,post_type as ctype,post_date as time from $wpdb->posts where post_type in ('post', 'works', 'downloads', 'book' ,'topic' ,'reply') and post_status='publish'
    union all
    select comment_ID as nid, comment_post_ID as cid, user_id as uid,comment_content as title,'comment' as ctype,comment_date as time from $wpdb->comments where comment_approved = 1
    union all
    select id as nid, comment_id as cid, user_id as uid,comment_id as title,'clike' as ctype,date_time as time from ".$wpdb->prefix."ulike_comments where status='like'
  union all
    select id as nid, post_id as cid,user_id as uid,post_id as title,'plike' as ctype,date_time as time from ".$wpdb->prefix."ulike where status='like'
) as ref left join $wpdb->users as user on user.id=ref.uid where user.id!=0 and user.id<50000 order by time desc");

    $quantity = $wpdb->get_results( $all_amount );
    $value = $quantity[0]->total;
    set_transient( 'activity_list', $value, DAY_IN_SECONDS );
    return $value; 
}
...