php image display

stalkio

New Member
Messages
45
Reaction score
0
Points
0
I am attempting to display an image from a search in a database stored in phpmyadmin. I have decided to store the images on the local server but I only managed to get the url of the image to show. After some research I reformed my coding in dreamweaver and came up with this:


Lines 257-265:
PHP:
<?php do { ?>
          <tr>
            <td><?php echo $row_rsdef3['search_name']; ?></td>
            <td><?php echo $row_rsdef3['word_code']; ?></td>
            <td><?php echo "<img src=\Images\Horse1.jpg"view.php?file={$row_rsdef3['http://xxx.co.uk/Images/Horse1.jpg']}">";

          </tr>
          <?php } while ($row_rsdef3 = mysql_fetch_assoc($rsdef3)); ?>
      </table></td>

However I now get this error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/stalkio/public_html/results4d.php on line 261

Can anyone show me what I'm doing wrong and help me to display the image?
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
The line which causes this error is:
PHP:
<td><?php echo "<img src=\Images\Horse1.jpg"view.php?file={$row_rsdef3['http://xxx.co.uk/Images/Horse1.jpg']}">";
I have no idea what you're trying to achieve there, but there must be some quoting errors there.
Maybe you ment to have
PHP:
<td><?php echo "<img src=\"view.php?file=".$row_rsdef3["http://xxx.co.uk/Images/Horse1.jpg"]."\">";

Also: img tags require an alt attribute ;-)
 
Last edited:

phpasks

New Member
Messages
145
Reaction score
0
Points
0
Why can use view.php file using direct image path & source file name & display it.
PHP:
<?php echo "<img src=\Images\".file={$row_rsdef3['http://xxx.co.uk/Images/Horse1.jpg']}">";
 

stalkio

New Member
Messages
45
Reaction score
0
Points
0
As a point of reference - this is how it was achieved:

PHP:
<img src="http://xxx.co.uk/Images/<?php echo $row_rsdef3['img_filename']; ?>"

With img_filename being a field on the table where the filenames are inserted as entries, e.g. liger.jpg

..thanks to all contributions - it all helped me get there/
 
Last edited:
Top