I am a beginner. I want to get the imageURL from mysql and display the image.
This is my code
<?php
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error){
die("Connection failed: " . $conn->connect_error);
} else {
echo "successful";
}
$url= "SELECT imgURL FROM icon WHERE id = 1 ";
$result = mysql_query($url,$conn);
$array = mysqli_fetch_array($result);
$imageData = base64_encode(file_get_contents($array));
echo '<img src="data:image/jpeg;base64,'.$imageData.'">';*/
?>
I can connect mysql. But there is a problem
Warning: mysql_query() expects parameter 2 to be resource
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result
Warning: file_get_contents(): Filename cannot be empty
Where is the problem? Dont I get any information from mysql?