php - How to loop within a for loop to get multiple values with the same ID -


i want data mysql database has same id different values. see image (this sample) although venue styles different, want pull styles same id. i'm using foreach loop data database.

how can improve code want.

<?php $myrows = $wpdb->get_results( "select vf_venues.title, vf_venues.mainimage, vf_venues.permalink, vf_venuestyles.slug vf_venues left join vf_venuestyles on vf_venuestyles.vid=vf_venues.vid vf_venuestyles.vid=vf_venues.vid" );?>

`

foreach ( $myrows $myrow ) { //pull data db "<pre>" $venuename = $myrow->title; $mainimage = $myrow->mainimage; $permalink = $myrow->permalink; $slug = $myrow->slug; $vid = $myrow->vid; "<pre>" ?>  <li class="venue-block block">     <div class="venue-img">         <a href="<?php echo $permalink; ?>">             <img src="<?php echo $mainimage; ?>">         </a>     </div>     <div class="venue-details"><h2><?php echo $venuename; ?></h2></div>     <?php echo $slug; ?>     <?php echo $vid; ?> </li>  <?php } ?> </div>` 

i managed fix creating loop within existing loop. created sql query pull venue styles venue.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -