Impossible to get info from SQL

Username (e.g. epiz_XXX) or Website URL

Error Message

I have information at mySQL, column name: message
My first page should print out column data.
Only two 'null’s from code, ‘var_dump’ are presented.
Can anybody help me printing out ==> echo $haksik[‘message’];

Other Information

My Code:
$haksik_result=mysqli_query($connect, “SELECT message FROM haksik”);

echo $haksik_result;



echo $haksik[‘message’];



If the code is just not writing anything after that, my best guess is that the code may be crashing. Can you please go into the control panel → Alter PHP Config and enable display_errors there? If you refresh the page after that, you may see an error message.


I did enabling 'display_errors".

1. This image is the result of code, echo $haksik_result ;
2. Blank is given as the result of code, echo $haksik[“message”]; ,which you can see when you go into my URL now.

Try this

$servername = "hostname";
$username = "username";
$password = "password";
$dbname = "myDB";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
  die("failed to connect: " . $conn->connect_error);

$sql = "SELECT * FROM haksik";
$rs = $conn->query($sql);

# uncomment this line below if this is not work for you
# var_dump($haksik);

while($haksik = $rs->fetch_assoc()){
echo $haksik[‘message’];

wow thanks ‘while’ works OMG

Glad to help you.

1 Like

For reference, the while loops through the mysql data in its own type of array structure

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.