I have this code (I know that the email is defined)
<?php
$con=mysqli_connect($host,$user,$pass,$database);
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT `note` FROM `glogin_users` WHERE email = '.$email.'");
while($row = mysqli_fetch_array($result))
echo $row
?>
In my MySQL database I have the following setup (Table name is glogin_users) id email note
I've tried extracting the note text from the database and then echo'ing it but it doesn't seem to echo anything.
You have to do this to echo it:
echo $row['note'];
(The data is coming as an array)
What you are doing right now is you are adding .
on the string and not concatenating. It should be,
$result = mysqli_query($con,"SELECT `note` FROM `glogin_users` WHERE email = '".$email."'");
or simply
$result = mysqli_query($con,"SELECT `note` FROM `glogin_users` WHERE email = '$email'");
$result = mysqli_query($con,"SELECT `note` FROM `glogin_users` WHERE email = '".$email."'");
while($row = mysqli_fetch_array($result))
echo $row['note'];
Source: Stackoverflow.com