0

I'm running such a simple SQL connection and select but I am getting very odd errors whilst running queries.

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\Webmaster\run\forum_mc.php on line 23

Warning: mysqli_query(): Empty query in C:\xampp\htdocs\Webmaster\run\forum_mc.php on line 24 ()

<?php
    $sqli_host = 'localhost';
    $sqli_dbname = 'forum_handling';
    $sqli_username = 'root';
    $sqli_password = ''; //null as defualt



$fhconnect = mysqli_connect($sqli_host, $sqli_username, $sqli_password, $sqli_dbname);

if (!$fhconnect) {
    echo "Error: Unable to connect to MySQL." . PHP_EOL;
    echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
    echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
    exit;
}


    $query = "SELECT Forum Title FROM forum_categories ORDER";
    $result = mysqli_query($fhconnect, $query);
    

    $row = mysqli_fetch_array($result, MYSQLI_NUM);
    $data = mysqli_query($fhconnect,$row); 
    printf ("%s (%s)\n", $row[0], $row[1]);

    mysqli_close($fhconnect);
Community
  • 1
  • 1
adepolo12
  • 33
  • 4

2 Answers2

0

check your field name Forum Title You can't put a blank space between Forum and Title , and also write order by fieldname

0

your query should be like as follows:

 $query = "SELECT Forum,Title FROM forum_categories ORDER BY Title";

chenge order by as you want.

romal tandel
  • 481
  • 12
  • 19