php - Parse error: syntax error, unexpected '',-2),'' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' -
"select " . table_prefix.db_usertable . "." . db_usertable_userid . " userid, " . table_prefix.db_usertable . "." . db_usertable_name . " username, " . table_prefix.db_usertable . "." . db_usertable_name . " link, " . db_avatarfield . " avatar,substring_index(substring_index(wp_usermeta.meta_value ,'"',-2),'"',1) role " . table_prefix.db_usertable . "left join wp_usermeta on " . table_prefix.db_usertable . "." . db_usertable_userid . "= wp_usermeta.user_id left join cometchat_status on " . table_prefix.db_usertable . "." . db_usertable_userid . " = cometchat_status.userid " . db_avatartable . " (select count(*) wp_bp_friends (initiator_user_id='" . $userid . "' , friend_user_id=wp_users.id) or (initiator_user_id=wp_users.id , friend_user_id='" . $userid . "'))=1 , wp_usermeta.meta_key = 'wp_capabilities' order username asc"
there error @ substring how avoid that.
the problem part of statement:
" avatar,substring_index(substring_index(wp_usermeta.meta_value ,'"',-2),'"',1) role "
you're using "
delimit php string, inside you're trying use sql strings containing "
. embedded quote terminating php string. need escape embedded quotes:
" avatar,substring_index(substring_index(wp_usermeta.meta_value ,'\"',-2),'\"',1) role "
Comments
Post a Comment