Welcome Guest, Not a member yet? Register   Sign In
Add subquery to main query result instead of running lots of foreachs
#4

[eluser]JoostV[/eluser]
You should be able to just loop through the results and print them out in your view file, something like this (I did not test this code)

Code:
if (count($versions) > 0) {
    // Store all songs and versions in a nested aray that we can easily print out
    $songs = array();
    foreach ($versions as $version) {
          $songs[$version['song_title']][$version['version_title']] = $version['version_title'];
    }

    // Print out the songs and versions form array
    echo '<h1>'.$versions[0]['disc_title'].'</h1>';
    echo ul($songs);
}
else {
    // Oops, no songs and versions found...
    echo '<h1>Disc not found</h1>';
    echo 'Sorry, this disc does not exist or it doesn not contain any songs';
}


Messages In This Thread
Add subquery to main query result instead of running lots of foreachs - by El Forum - 08-20-2010, 06:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB