-2

Really don't know whats up here but it's not returning anything on the page.. I am slowly changing everything from MySQL to the new 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>';
 }
?>

Any help greatly appreciated! I am also you <?php echo $testslists; ?> in my html! Many thanks Phillip Dews

DevZer0
  • 13,433
  • 7
  • 27
  • 51
Phillip Dews
  • 51
  • 10
  • First, prove you connected to the db at all. How would you do that? how do you know it worked? – Cups Jul 31 '13 at 11:00

2 Answers2

2

Your only problem is insufficient error reporting

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

Just add these lines at the top of your code and you will be immediately informed of the exact problem with your code.

Note that on the production server you have to turn displaying errors off and logging on

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
1

mysqli_query needs connection to be the first parameter. please pay close attention to mysqli functions as many of them required the connection as the first parameter.

$result = mysqli_query($con, $query) or die (mysqli_error());
DevZer0
  • 13,433
  • 7
  • 27
  • 51