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]


Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.