Php MySQLi获取数组返回Null

Php MySQLi获取数组返回Null,php,mysqli,Php,Mysqli,我真的不知道这里有什么,但它没有在页面上返回任何内容。。我正在慢慢地将所有内容从MySQL更改为新的MySQLi <?php include_once "php_includes/db_conx.php"; $query = "SELECT * FROM testimonials ORDER BY id ASC LIMIT 32"; $result = mysqli_query($query) or die (mysqli_error()); while ($row = mysqli_fe

我真的不知道这里有什么,但它没有在页面上返回任何内容。。我正在慢慢地将所有内容从MySQL更改为新的MySQLi

<?php
include_once "php_includes/db_conx.php";
$query = "SELECT * FROM testimonials ORDER BY id ASC LIMIT 32";
$result = mysqli_query($query) or die (mysqli_error());
while ($row = mysqli_fetch_array($result)){
   $testtitle = $row['testtitle'];
   $testbody = $row['testbody'];
   $compowner = $row['compowner'];
   $ownertitle = $row['ownertitle'];
   $compname = $row['compname'];
   $compwebsite = $row['compwebsite'];

   $testsList .= '<div class="gekko_testimonial testimonial gekko_testimonial_speech">  
       <div class="gekko_main"><div class="gekko_headline">' . $testtitle . '</div>
        <p>' . $testbody . '</p>
        </div>
         <div class="speech_arrow"></div>   
         <span class="gekko_who_client_name">' . $compowner . ' of ' . $compname . '</span>
         <span class="gekko_who_job_title">' . $ownertitle . '</span>
         <span class="gekko_who_website">View the Website... <a href="http://' . $compwebsite . '" target="_blank">' . $compwebsite . '</a></span>
      </div>';
 }
?>

非常感谢您的帮助!我也是你
在我的html中! 非常感谢
Phillip Dews

mysqli_query
需要连接作为第一个参数。请密切关注mysqli函数,因为许多函数都需要连接作为第一个参数

$result = mysqli_query($con, $query) or die (mysqli_error());

您唯一的问题是错误报告不足

error_reporting(E_ALL);
ini_set('display_errors',1);
只需在代码的顶部添加这些行,您就会立即知道代码的确切问题


请注意,在生产服务器上,您必须先关闭显示错误和登录

,证明您已连接到数据库。你会怎么做?你怎么知道它起作用了?非常感谢我所做的一切就是添加$result=mysqli_query($db_conx,$query)或die(mysqli_error());去吧!