Jump to content

[SOLVED] Don't know how to display a image in php.


Redlightpacket

Recommended Posts

Here is my code right here. I need some help with displaying the image in the code. I might be having a bug.

$query = "SELECT * FROM picture_tb";

$result = mysql_query($query)
or die("Query failed: " . mysql_error());


while ($row = mysql_fetch_assoc($result))
{
echo'<table border="1">
<tr>
<td>';echo $row["id"];echo'</td>




<td><IMG SRC="';echo'file:///C:/wamp/www/';$row['picture'];echo'">';echo'</td>




<td>';echo $row["title"]; echo'</td>
<td>';echo $row["desc"]; echo'</td>


</tr>
</table>
';
}
////////////////////////////////////////////////////////code]


Hello

 

I'm not sure about weather you should have those semi's and echo's that way.... I could be wrong though.

 

<td>';echo $row["id"];echo'</td>

 

I have not seen code laid out this way but that doesn't mean it is wrong either :)

try

 

$query = "SELECT * FROM picture_tb";

$result = mysql_query($query) or die("Query failed: " . mysql_error());


while ($row = mysql_fetch_assoc($result))
{
echo'<table border="1"><tr><td>';
echo $row["id"];
echo'</td><td><IMG SRC="';
echo "file:///C:/wamp/www/".$row['picture']."\"></td><td>";
echo $row["title"]; echo'</td><td>';
echo $row["desc"];
echo'</td></tr></table>';
}
////////////////////////////////////////////////////////code]



 

hope this helps in some way

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.