I have the following image list on an html page that I am converting into php to be driven from a mysql database. While I thought it was a simple enough procedure -I am struggling to avoid syntax errors because of the existing use of ' in my code.
I need to convert a simple list of images into an array based on what is in the database. The html list is:
<li><a href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: './imgProd/2.jpg',largeimage: './imgProd/2.jpg'}">
<img src='imgProd/2.jpg' style="width:110px; height:110px;"></a></li>
<li><a href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: './imgProd/3.jpg',largeimage: './imgProd/3.jpg'}">
<img src='imgProd/3.jpg' style="width:110px; height:110px;"></a></li>
<li><a href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: './imgProd/4.jpg',largeimage: './imgProd/4.jpg'}">
<img src='imgProd/4.jpg' style="width:110px; height:110px;"></a></li>
I am trying to generate this from php using:
<?php
$result = mysql_query("SELECT * FROM table WHERE id='$id'");
while($row = mysql_fetch_array($result))
{
echo '<li>';
echo '<a href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: './' . $row['photo'] . '',largeimage: './' . $row['photo'] . ''}">';
echo '<img src=' . $row['photo'] . '' style="width:110px; height:110px;">';
echo '</a>';
echo '</li>';
}
?>
but am obviously getting loads of syntax errors as I am attempting to use single quotes within single quotes (I assume!?). Does anyone know how I can incoporate this list into an array??
Thanks very much in advance
JD
javascript:void(0);? Why not just#?