chrisfane Posted August 22, 2007 Share Posted August 22, 2007 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 https://forums.phpfreaks.com/topic/66244-solved-trying-to-create-dynamic-image-links/ Share on other sites More sharing options...
lilwing Posted August 22, 2007 Share Posted August 22, 2007 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 https://forums.phpfreaks.com/topic/66244-solved-trying-to-create-dynamic-image-links/#findComment-331319 Share on other sites More sharing options...
chrisfane Posted August 27, 2007 Author Share Posted August 27, 2007 ok, thanks. My only concern is that i was intending to use this code within a while loop. is this still likely to work if the while loop is broken up with <?PHP and ?> marks ? Link to comment https://forums.phpfreaks.com/topic/66244-solved-trying-to-create-dynamic-image-links/#findComment-335645 Share on other sites More sharing options...
socratesone Posted August 27, 2007 Share Posted August 27, 2007 <?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 https://forums.phpfreaks.com/topic/66244-solved-trying-to-create-dynamic-image-links/#findComment-335660 Share on other sites More sharing options...
chrisfane Posted August 27, 2007 Author Share Posted August 27, 2007 ahhh, ok. thankyou very much Link to comment https://forums.phpfreaks.com/topic/66244-solved-trying-to-create-dynamic-image-links/#findComment-335662 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.