I have this php script:
<?php $bets = $wpdb->get_results( 'SELECT * FROM `bet` WHERE match_id = '. $_GET['match_id'] ); ?>
<?php foreach($bets as $bet): ?>
<?php echo $bet->bet_name; ?>
<?php $choices = $wpdb->get_results( 'SELECT * FROM `choice` WHERE bet_id = '. $bet->id ); //fetch choices
?>
<?php
if(count($choices))
{
foreach($choices as $choice)
{
echo "". $choice->choice_name . "";
}
}
else
{
echo "<h3> Not found, sorry </h3>";
}
?>
<?php endforeach; ?>
I need to create a jquery tabs based on these data.
I need a tab foreach $bet that contain the relative $choice.
How can i do it ?
If I understand what you need, You need to create both the tabs and their content divs.
Loop through $bets twice, once for the tabs, once for the the panes.
P.S. I think a for loop might work better for you than a foreach loop