php - How do I print a list from the data in my database -


i want display list of these points shown in table.

folio_mainpoint_bulletpoint_table idfolio   idmainpoint   idbulletpoint 8         13            14 8         13            15 8         14            16 8         15            17 8         15            18 8         15            19 

these tables have:

foliotable  idfolio folio 8       123  mainpointtable idmainpoint mainpoint 13          animals 13          animals 14          flowers 15          insects 15          insects 15          insects  bulletpointtable idbulletpoint bulletpoint 14            dog 15            cat 16            rose 17            ant 18            grasshopper 19            fly 20            ladybug 

the output should be:

folio 123  animals  1. dog  2. cat  flowers  1. rose  insects  1. grasshopper  2. fly  3. ladybug 

i stuck in because keep looping data without being able print out list of data related folio idfolio of 8. code have far:

$sql = mysqli_query(" select * folio_mainpoint_bulletpoint_table idfolio='8' ") or die(mysql_error());  while($row = mysqli_fetch_array( $sql )) {  echo  $folio = $row['idfolio']; $idbulletpoint = $row['idbulletpoint '];  $sql2 = mysql_query("select bulletpoint bulletpointtable idbulletpoint ='$idbulletpoint' ");    while($row = mysqli_fetch_array( $sql2 )){     }  } 

try code.. mysql_fetch_assoc()

    $sql = mysql_query("select * folio_mainpoint_bulletpoint_table idfolio='8'") or die(mysql_error());      while($row = mysql_fetch_assoc( $sql )) {      echo  $folio = $row['idfolio'];     $idbulletpoint = $row['idbulletpoint '];     $sql2 = mysql_query("select bulletpoint bulletpointtable idbulletpoint ='$idbulletpoint' ");        while($row1 = mysql_fetch_assoc( $sql2 )){    echo $row['column_name'];        }      } 

Comments