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

 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

<?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 } ?>

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.