mysql - retrieve and display php array values when retrieving all records from database -
i displaying complete record of user in profile section, fetching rows , problem within rows i've got 2 fields arrays, 'secondarysubject' , 'secondarygrade' want display
2002-2004 ----------- level ------- school name
science maths b
i able display them prints dates, school name , level name every subject rather once subjects. posting code, can pleaseeee me it.
$result2 = $db->query(' select * secondaryeducation userid = "'.$graduateid.'" order secondaryfinishdate desc '); $totalrows2 = mysql_num_rows($result2); if($totalrows2 > 0) { $html .= '<h2>secondary education: '.$option.'</h2>'; while($row = mysql_fetch_assoc($result2)) { $startyear = formatdate($row['secondarystartdate'], 'y'); $finishyear = formatdate($row['secondaryfinishdate'], 'y'); if (!empty($row['secondarygrade'])) $secondarygrade = getsecondarygradename($row['secondarygrade']); else $secondarygrade = $row['secondarygradecustom']; $html .= ' <div class="secondarylisting"> <div><strong>'.$startyear.' - '.$finishyear.' '.stripslashes($row['secondaryschool']).'</strong></div> <div>'.stripslashes(getsecondarylevelname($row['secondarylevel'])).' in '.stripslashes(getsecondarysubjectname($row['secondarysubject'])).' - '.stripslashes($secondarygrade).'</div> </div><!-- end education listing --> '; } }
it looks inside while statement. every time loops include it. try moving outside while statement.
Comments
Post a Comment