I'm using 000webhost for my php server and phpmyadmin for my database. My image row looks like
image varchar(100) utf8_unicode_ci
What i'm trying to do is someone inputs a username and it outputs the image associated with that username. Here's my html:
<!DOCTYPE html>
<html>
<body>
<form action="showimage.php" method="GET">
<h2>Show Image</h2>
Username: <input type="text" name="username" /><br>
<input type="submit" value="Show Image" />
</form>
</body>
</html>
and my php:
<!DOCTYPE html>
<html>
<body>
<?php
$host='localhost';
$user='id1783920_123456';
$pass='';
$db='id1783920_mydb';
$con=mysqli_connect($host,$user,$pass,$db);
if($con) {
//echo 'connected successfully to id1783920_mydb database<br><br>';
}
$id = mysqli_real_escape_string($_GET['id']);
$query = mysqli_query("SELECT * FROM 'blob' WHERE 'id'='$id'");
while($row = mysqli_fetch_assoc($query) {
$imagedata = $row[`image`];
}
echo"$imagedata";
mysqli_close($con);
?>
<img src="showimage.php?username=$_GET['username']">
</body>
</html>
Can someone please give me some suggestions? Thanks so much! I also keep getting this error
Parse error: syntax error, unexpected ';' in /storage/h11/920/1783920/public_html/Complete/showimage.php on line 23