Jump to content

[SOLVED] Trying to create dynamic image links


chrisfane

Recommended Posts

Im trying to create a basic dynamic gallery, so the details for each entry are taken from the mysql database

 

i need to create a link structure that looks like the one below, but im not sure how to avoid issues with speech marks etc.

 

<a href="gallery/".$row['Imagename']." " rel="Gallery" title="".$row['Caption'].""><img src="gallery/".$row['Thumbname']."" width="".$row['Width']."" height="".$row['Height']."" alt="" border="0"/></a>

 

any help would be most appreciated.

 

Thanks

 

if you mean by speech marks things such as apostrophes and < and > there is a simple code for this that you can input. for example < would be <

 

check out w3schools for that, i am not sure what it is called.

 

you'll need a <?php and a ?> in the href and source to declare the php

 

oh and jsut for reference it would look something like

 

<a href="<?php echo "gallery/"; echo $row['Imagename'] ?>" <" rel="Gallery" title="<?php echo $row['Caption'] ?>"><img src=<?php echo "gallery/"; echo $row['Thumbname']; ?>" width="<?php $row['Width'] ?>" height="<?php $row['Height']. ?>" alt="" border="0"/></a>

<?php
while($row = mysql_fetch_array($result)){ ?>

   <a href="gallery/<?= $row['Imagename'] ?>" 
       rel="Gallery"
       title="<?= $row['Caption'] ?>">

          <img src="gallery/<?= $row['Thumbname'] ?>"
                 width="<?= $row['Width'] ?>"
                 height="<?= $row['Height'] ?>"
                 alt="<?= $row['Caption'] ?>"
                 border="0"/>

   </a>

<?php } ?>

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.