Jump to content

placing an image path in mySQL and display in using php in dreamweaver trouble


Funky348

Recommended Posts

For my uni project i have created a website for my local rugby team... I have a database of players and in that database i have a column for player photo. I was told to just put the path to the image in the player record which i did (the column is a VARCHAR(255).

The path i inserted is  H:\WebDesign2\Xampp\htdocs\BedlinogRFC\images\Benji.jpg (the image is definitely where i said it is i copied the path from the properties)

 

My image is isnt displaying just the alt text. I have searched everywhere for fix to my problem but cant find where im going wrong!! Any help will be great.

 

Below is my dreamweaver code:

<div class="playerProfilePhotoContainer">
    <table height="250" width="299" border="0" cellpadding="3">
       <caption>
           Player Photo
       </caption>
       <tr>
           <td><img src="<?php echo $row_Recordset1['ProfilePhoto']; ?>" alt="Profile Photo of Player"/></td>
       </tr>
    </table>
</div>

1) You should fetch all results from database using  while ($row = mysqli_fetch_array($result))

2) The link to output should be ,  <?php echo "<img src='$picture'  width='150px'/>" ?>

 

Take a look and understand it, change your code accordingly.

the src=" ... " attribute is the URL where the browser fetches the image from on your server. it is not the file system path where the image is stored at on your server.

 

the URL is relative to your document root/htdocs folder - ref: http://en.wikipedia.org/wiki/Uniform_Resource_Locator

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.