-2

真的不知道这里发生了什么,但它没有在页面上返回任何内容。我正在慢慢将所有内容从 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>';
 }
?>

非常感谢任何帮助!<?php echo $testslists; ?>在我的html中我也是你!非常感谢 Phillip Dews

4

2 回答 2

2

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

error_reporting(E_ALL);
ini_set('display_errors',1);

只需在代码顶部添加这些行,您就会立即被告知代码的确切问题。

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

于 2013-07-31T11:01:39.197 回答
1

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

$result = mysqli_query($con, $query) or die (mysqli_error());
于 2013-07-31T10:59:33.397 回答