php - if loop to bold certain records and keep others non-bold -
i'm trying returned records database. i'm looking bold returned questions (returned = 1) , non-bold questions (returned = 0) haven't been returned page http://starsqa.com/qbank
this query code far:
<?php include("db_conn.php"); $qry_string = "select * stars order starname asc"; $prep = $pdo_conn->prepare($qry_string); $prep->execute(); while ($row = $prep->fetch(pdo::fetch_assoc)) { echo "<button class='tosearch spcbtn' id='tglbtn{$row['starid']}'>{$row['starname']}</button>"; echo "<div style='clear:both;'></div>"; echo "<div style='color:black;' class='tgldiv' id='tgldiv{$row['starid']}'><b>{$row['starname']}</b><br><ol>"; $qry_stringq = "select * questions starid = ? && approved = 1"; $prepq = $pdo_conn->prepare($qry_stringq); $prepq->execute(array($row['starid'])); while ($rowq = $prepq->fetch(pdo::fetch_assoc)) { echo "<li style='margin:30px'>{$rowq['question']}</li>"; } echo "<ol'></div>"; echo "<div style='clear:both;'></div>"; } ?> if type in geno segers search box , open button questions 1-26 should bold , question 27 should non-bold
maybe this?
while ($rowq = $prepq->fetch(pdo::fetch_assoc)) { $bold = $rowq['returned'] == 1 ? ' font-weight:bold;' : ''; echo "<li style='margin:30px;{$bold}'>{$rowq['question']}</li>"; }
Comments
Post a Comment