mysql - Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, null given in C:\wamp\www\widget_corp\data_base.php -
i trying select data mysql table, warnings:
notice: undefined variable: result in c:\wamp\www\widget_corp\data_base.php on line 40
and one:
warning: mysqli_fetch_row() expects parameter 1 mysqli_result, null given in c:\wamp\www\widget_corp\data_base.php on line 40
this code:
   $connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);      // test if connection occured      if (mysqli_connect_errno()){         die ("database connection failed: " . mysqli_connect_errno() . " (" .              mysqli_connect_errno() . ")"  );     }      // perform database query     $query = "select * subjects " ;      $resut = mysqli_query($connection, $query);      // test if there query error     if (!$resut){       die ("database connection failed!");     }      // use return data if     while ($row = mysqli_fetch_row($result)){       //output data each row       var_dump($row);       echo "<hr />";     }   everything works fine until while(). suggestions/solutions? in advance!
be more attentive, have syntax mistake in:
$resut = mysqli_query($connection, $query);   change to:
$result = mysqli_query($connection, $query);   and change to:
if (!$result){       die ("database connection failed!"); }      
Comments
Post a Comment