I am trying to display images by taking their path to the file from the sql table, but I have a lot of problems.
Here's what happens:
$imageis a variable containing text "itemimg/hyuna.png"that is the path to the image.
$image = 'itemimg/hyuna.png';
I assumed that I could display the image outside the php block as follows:
<img src= "<? $image ?>" alt="test"/>
For some reason this does not work.
So I thought that maybe it cannot read the variable outside of the php block (I'm a newbie), so for testing, I did:
<h1> "<? $image ?>" </h1>
It displays itemimg/hyuna.pngas an h1 banner.
This means that it is accessing the varible prefix.
So I thought the way was wrong. So I tried:
<img src= "itemimg/hyuna.png" alt="test"/>
This image perfectly displays the image.
, , , "test" "alt="
:
sql ?
:
$q = "select * from item where id=$id";
$results = mysql_query($q);
$row = mysql_fetch_array($results, MYSQL_ASSOC);
$image = ".$row['image'].";
item - : image,