i have an upload form with a text area and when the user uploads his image and writes in the description the text gets uploaded to the database all fine.the problem im having is not knowing how to get the text from the database and display it in its own <p>. what is happening at the moment is when the user clicks a thumbnail it takes them to a page called image.php which detects what id the image is and displays that correct image. what i need it to do is display the correct text for the correct id.
the image.php form looks like this:
<?php
$dbLink = new mysqli('localhost', 'root', '', 'gallery');
if(mysqli_connect_errno()) {
die("MySQL connection failed: ". mysqli_connect_error());
}
if(isset($_GET['id']) && is_numeric($_GET['id'])) {
$id= $dbLink->real_escape_string($_GET['id']);
} else {
$id = 53;
}
$query = "SELECT name, size, image_path FROM images WHERE id = $id";
$result = $dbLink->query($query, MYSQLI_STORE_RESULT);
while($row = $result->fetch_row()) {
echo "<img src=\\"" . $row[2] . "\\" />"; // you could also play with the other $row[] variables returned by the query here.
}
?>
i am not very good at php and im pretty sure this is a very basic thing to do but i cant get my head around it.
thanks for listning