Issue with MySQL data and Jquery popup box

Get help on web editors (Frontpage, Dreamweaver) and web languages (HTML, ASP, PHP).
Post Reply
FuZzY665
Registered User
Posts: 58
Joined: 11 Aug 2006, 02:00
Location: Durban
Contact:

Issue with MySQL data and Jquery popup box

Post by FuZzY665 »

Hey Guys

I'm trying to call a set of images and descriptions from a MySQL database. Everything works great until the user clicks a button for additional info which calls a jquery popup which is suppose to display the description. It does what its suppose to, but only shows the info for the 1st image on every image.
Could it be an issue between the php and javascript?
Thanks

Javascript that calls popup:

Code: Select all

<script type="text/javascript">
	$(document).ready(function() {
		$(".popup").colorbox({width:"50%", inline:true, href:"#inline"});
	});
</script>
Php that shows image and popup info:

Code: Select all

<?php
mysql_select_db($database_conn_macph, $conn_macph);
$range = $_GET['range'];
$intCount;
$result = mysql_query("SELECT * FROM product_info WHERE range_name = '$range'");
            while($row = mysql_fetch_array($result)) {
                echo "<div class='panel'>";
                    echo "<table width='100%'>";
                        echo "<tr>";
                            echo "<td>";
                            echo "<img src='".$row['image']."' border='0px' />";
                            $intCount = $row['description'];
                            echo "<a class='popup'><img src='images/buttons/info.png' width='38px' style='float:right; padding-right:22px;' /></a>";
                            echo "<div style='display:none'>";
                                echo "<div id='inline' style='padding:1px; background:#fff; text-align:left;'><p>".$row['description']."</p></div>";
                            echo "</div>";
                            echo "</td>";
                        echo "</tr>";
                    echo "</table>";
                echo "</div>";
            }
        ?>
Damina
Registered User
Posts: 42
Joined: 06 Sep 2005, 02:00
Contact:

Re: Issue with MySQL data and Jquery popup box

Post by Damina »

I may be wrong here, but what it looks like to me is that JQuery could be assigning an ID to the info box.
This could be causing confusion for the library as to which placeholder to use, and as a result would use the first one assigned to that ID.
try give your info div an ID, that increments each time the while loop runs.
Post Reply