0

I have a basic connect file, I made it simplistic for the sake of it as i'm only testing if it works.

<?php
   $dbc= @mysql_connect('localhost', 'root', '', 'games_night')
   or die('Connection Error'. mysqli_connect_error());
?>

this works fine

but it gets as far as if($response) then nothing happens

<?php
require_once('D:\Xamp\xampp\htdocs\firstsite\connect.php');

 $query = "SELECT host, reviewer, stars, description FROM reviews";

$response = @mysqli_query($dbc, $query);

if($response){


while($row = mysqli_fetch_array($response)){

  echo $row['host'];
 echo $row['description'];
 echo $row['reviewer'];
 echo $row['star'];

}

}else{
 echo 'gone wrong';
}


?>

if i change it to if(!response) this is the error

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in D:\Xamp\xampp\htdocs\firstsite\reviews.php on line 31

but the sql query works perfect in php myadmin

Barmar
  • 741,623
  • 53
  • 500
  • 612

0 Answers0