php - Inserting rows for grandparents and great grandparents -


i'v created query display table lists state birds, gs.symbol = bird's common name (e.g. robin) , gs.latin = scientific name. gg.name = name of state (e.g. alaska), , gg.idparent = 'usa'. display looks this:

<tr><td>brown thrasher</td><td>georgia</td></tr>  <tr><td>robin</td><td>michigan, wisconsin</td></tr> 

and here's query:

$stm = $pdo->prepare("select gs.symbol, gs.latin, group_concat(gg.name) names, gg.idparent gw_geog gg left join gs gs on gs.idarea = gg.idarea gg.idparent = 'usa' , gs.desiggen = :refcat group gs.symbol order gs.symbol, gg.name"); $stm->execute(array( 'refcat'=>$refcat, )); 

i modify table rows ordered taxonomically, , rows featuring names of families (grandparents) , orders (great grandparents) inserted, this:

<tr><td><b>passeriformes</b> (order)</td><td></td></tr>  <tr><td><b>turdidae</b> (family)</td><td></td></tr>  <tr><td>brown thrasher</td><td>georgia</td></tr>  <tr><td>robin | michigan</td><td>wisconsin</td></tr> 

the table need join gz_life, , key columns taxon , parent.

let's use mourning dove example. gs.latin = 'zenaida-macroura', matches value in gz_life.taxon. in same row, gz_life.parent = 'zenaida' (a genus name). zenaida's parent 'columbidae' (a family name). columbidae's parent 'columbiformes' (an order name).

those 2 values want retrieve - family (columbidae) , order (columbiformes).

<tr><td><b>columbiformes</b> (order)</td><td></td></tr>  <tr><td><b>columbidae</b> (family)</td><td>  <tr><td>mourning dove</td><td>wisconsin</td></tr> 

does know how can that?


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -