0

Probably a noob question, but one learns by asking.

I am trying to set up a table to load and display data from my database. I have gotten everything to work except the final column. I want the final column to be a link that says "view images" and when you click it, it opens up a fancybox JS.

Here's my source code:

    <script>
$(document).ready(function() {
    $(".fancybox-thumb").fancybox({
        prevEffect  : 'none',
        nextEffect  : 'none',
        helpers : {
            title   : {
                type: 'outside'
            },
            thumbs  : {
                width   : 50,
                height  : 50
            }
        }
    });
});
</script>


<?php




mysql_select_db("premiumguns") or die(mysql_error());


echo "<table id='myTable' class='info' width='100%' border='0' cellspacing='0' cellpadding='0'>";
echo "<thead><tr> <th>Serial</th> <th>Make</th> <th>Model</th> <th>Gauge</th> <th>Barrel</th> <th>Details</th></tr></thead><tbody>";

// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {


    // Print out the contents of each row into a table

    echo "<tr><td height=\"20px\">"; 
    echo $row['Serial_No'];
    echo "</td><td>"; 
    echo $row['Make'];
    echo "</td><td>"; 
    echo $row['Model'];
    echo "</td><td>"; 
    echo $row['Gauge'];
    echo "</td><td>"; 
    echo $row['Barrel_Length'];
    echo "</td><td>";
    echo "<a class = "fancybox-thumb" rel="gallery1" href="wp-content/prem_pics/C16719B/C16719B-01.jpg">View Pictures</a>"
    echo "</td></tr>"; 
} 

echo "</tbody></table>";
?>
</body>

any help would be greatly appreciated

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 2
    Double check your quotes, you're not escaping properly, see syntax highlighting? – elclanrs Jul 25 '13 at 20:54
  • 1
    *PSA:* The `mysql_*` functions are [deprecated in PHP 5.5](http://php.net/manual/en/faq.databases.php#faq.databases.mysql.deprecated). It is not recommended for writing new code as it will prevent you from upgrading in the future. Instead, use either [MySQLi](http://php.net/manual/en/book.mysqli.php) or [PDO](http://php.net/manual/en/book.pdo.php) and [be a better PHP Developer](http://jason.pureconcepts.net/2012/08/better-php-developer/). – Jason McCreary Jul 25 '13 at 20:57
  • Asking on Stackoverflow requires you not only to formulate a request for help but to turn your code-related problem into a concrete programming question. – hakre Jul 25 '13 at 21:23

1 Answers1

3

You need to use single quotes around this line

<?php
    echo '<a class = "fancybox-thumb" rel="gallery1" href="wp-content/prem_pics/C16719B/C16719B-01.jpg">View Pictures</a>';
?>
Khawer Zeshan
  • 9,470
  • 6
  • 40
  • 63