php - select order by - heading of items in group -


i have table "items" musical pieces, headers "title" "composer" "description".. various pieces per composer.. trying php script select * items, order "composer" generate header in while composer, output rows work, , on next.. i.e.:

items table

------------------------------- david drury   | piece 1  | info ------------------------------- david drury   | piece 2  | info -------------------------------- alfonzo smith | piece 1  | info -------------------------------- david drury   | piece 3  | info 

output

david drury

  • piece 1 | info
  • piece 2 | info
  • piece 3 | info

alfonzo smith

  • piece 1 | info

can 1 table? or might able create table composers join can see composer, output header, outport pieces join in items table?

got it.. subquery. whom might help, i've used:

$sqlcommand = "select distinct composer items";  $query = mysqli_query($db_conx, $sqlcommand) or die (mysqli_error());   while ($row = mysqli_fetch_array($query)) {  $composer = $row["composer"]; echo '<h2>'.$row["composer"].'</h2>'; $sqlcommand2 = "select * items composer = '$composer'";  $query2 = mysqli_query($db_conx, $sqlcommand2) or die (mysqli_error());  while ($row2 = mysqli_fetch_array($query2)) {      $idpart = $row2["idpart"];     $composer = $row2["composer"];     $title = $row2["title"];     $opus = $row2["opus"];     $instrumentation = $row2["instrumentation"];     $type = $row2["type"];     $ismn = $row2["ismn"];     $rrp = $row2["rrp"];     $information = $row2["information"];        echo '<h5>'.$title.' - '.$information.'</h5>'; }             } 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -