Hi I am trying to set up spry tabbed panels with dynamic data, i want to use single query to do this job, i am getting results only in “Tab 1” , “Tab 2”, “Tab 3” does not show any data, i think i am using while loop in repating region three times with same query, that is why this is happening, i tried with foreach loop but no help, this is my testing code so far, please suggest what is the correct way to do this.
Thanks.
my spry tabbed panel code are like this.
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup">
<li class="TabbedPanelsTab" tabindex="0">Tab 1</li>
<li class="TabbedPanelsTab" tabindex="0">Tab 2</li>
<li class="TabbedPanelsTab" tabindex="0">Tab 3</li>
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent">
<?php while ($list = mysql_fetch_assoc($queryresult)): ?>
<div class="category-main-container">
<div class="category-main-desc"> <?php echo $list['title'];?></a>
</div><!--end of category-desc-->
</div><!--end of category-container-->
<?php endwhile;?>
</div>
<div class="TabbedPanelsContent">
<?php while ($list = mysql_fetch_assoc($queryresult)): ?>
<div class="category-main-container">
<div class="category-main-desc"> <?php echo $list['id'];?></a>
</div><!--end of category-desc-->
</div><!--end of category-container-->
<?php endwhile;?>
</div>
<div class="TabbedPanelsContent">
<?php while ($list = mysql_fetch_assoc($queryresult)): ?>
<div class="category-main-container">
<div class="category-main-desc"> <?php echo $list['rating'];?></a>
</div><!--end of category-desc-->
</div><!--end of category-container-->
<?php endwhile;?>
</div>
</div>
</div>
<script type="text/javascript">
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
</script>
and php query is like this.
$offset = ($currentpage - 1) * $rowsperpage;
$sqlquery = "SELECT * FROM $tablename ORDER BY $orderby $sortby LIMIT $rowsperpage OFFSET $offset";
$queryresult = mysql_query($sqlquery, $connection) or trigger_error("SQL", E_USER_ERROR);
Simpler way to do this is by using separate MySQL query for each tab, like this
and in tabbed menu do like this.
this should fix your problem.