mysqli_fetch总是返回null

时间:2018-09-06 08:45:16

标签: php

我只是想显示正在运行的查询的结果。当我运行查询时,我被告知我有6个字段。

但是当我获取它时,它返回null。

<?php           
    include($_SERVER['DOCUMENT_ROOT'].'/website/administrator/components/com_memberportal/Default/Default.php');                  //Include functions & other needed default-settings

    $selected_event = 1;
    $searchq = "jo";

    $search_query = "SELECT b6vjp_user_info.id, b6vjp_user_info.academic_title, b6vjp_user_info.firstname, b6vjp_user_info.lastname, b6vjp_invitation.participated, b6vjp_organisation.name 
                     FROM b6vjp_user_info
                     INNER JOIN b6vjp_invitation ON b6vjp_user_info.id=b6vjp_invitation.user_info_id
                     INNER JOIN b6vjp_organisation_assignment ON b6vjp_user_info.id=b6vjp_organisation_assignment.user_info_id
                     INNER JOIN b6vjp_organisation ON b6vjp_organisation_assignment.organisation_id=b6vjp_organisation.id
                     INNER JOIN b6vjp_membership ON b6vjp_user_info.id=b6vjp_membership.user_info_id
                     WHERE b6vjp_user_info.id = b6vjp_invitation.user_info_id AND b6vjp_membership.group_id='1' AND b6vjp_invitation.event_id = '$Event_id' AND b6vjp_user_info.firstname LIKE '%$searchq%'
                     OR b6vjp_user_info.id = b6vjp_invitation.user_info_id AND b6vjp_membership.group_id='1' AND b6vjp_invitation.event_id = '$Event_id' AND b6vjp_user_info.lastname LIKE '%$searchq%'";

    $search_data = mysqli_query($GLOBALS['connect'], $search_query);
    $search_data_fetched = mysqli_fetch_array($search_data);



    print_r($search_data);
?>
    <br />
    <br />
    <br />
<?php 

    echo "Im not empty! Look:" . print_r($search_data_fetched);

在此处显示输出:

enter image description here

我尝试过fetch_all,fetch all($ search_data_fetched,MYSQLI_ASSOC),fetch_array,fetch_assoc。

我仔细检查了查询,它是正确的。

编辑:我的大嘴巴。实际上是查询。我使用了错误的变量。抱歉!

为什么提取时将结果“转换”为null?

0 个答案:

没有答案