I am having a little trouble trying to display the image at ID: 2 in my store table...
here's what i've come up with (p.s. the reason I set $id = 2 is because I plan on making this a loop where I will increment that value to print other images)
<!DOCTYPE html> <html> <head> <title>Gallery</title> </head> <body> <?php mysql_connect ... mysql_select_db ... $id = 2; $image = mysql_query("SELECT * FROM store WHERE id=$id"); $image = mysql_fetch_assoc($image); $image = $image['image']; echo $image; ?> </body> </html>
mysql_*functions in new code. They were removed from PHP 7.0.0 in 2015. Instead, use prepared statements via PDO or MySQLi. See Why shouldn't I use mysql_* functions in PHP? for more information.SELECT *if you only useimage? JustSELECT image. The rest of the columns are just wasted resources.