• wdlyons

    (@wdlyons)


    Hi I am trying to check the page user $id against the id of a row from the wordpress database and if they equal print first_name and family-name information.

    The code I am trying to use is but I cannot seem to get it to work.

    global $wpdb;
    
    $result = $wpdb->get_results( "SELECT * FROM wp_lb_person"); 
    
    if (id == $id) {
    
    echo $row->first_name."  ".$row->family_name;
    
    }
    else
    {
    	echo 'Not Working';
    }

    Any advise or assistance would be appreciate.

    This code is added to the page via shortcode

    Regards

    Warwick

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You cannot output code to a page via shortcode. Any processing must be done by the shortcode callback routine. The resulting text to be output should be returned by the callback routine, never echoed.

Viewing 1 replies (of 1 total)
  • The topic ‘If statement to check $id with row idproblem’ is closed to new replies.