When you select an array from the database, you may want to output each row to list items or table rows. Either way, the data for each list item or table row will look identical unless you specify otherwise.
The examples below shows how to alter the color for each list item from the database.
or
$background= ‘#CFCFCF’;?>
<ul id=”ul” ><?
$command = “SELECT id,catid,question, question_type FROM table1 WHERE question_type=’3′ and table1.catid=3 ORDER BY RAND() LIMIT 3″;
$result = mysqli_query($db, $command);
if ($result && mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$background =($background==’#CFCFCF’ ? ‘#ffffff’ : ‘#CFCFCF’);
?><li style=”padding:10px 10px 10px 10px;background:<?php echo $bg;?>”>
© 2018 ALL Rights Reserved | Sitemap
Vancouver | North Vancouver | Burnaby | Richmond | Coquitlam | Port Coquitlam | Surrey | Langley | Maple Ridge | Mission | Abbotsford | Kamloops | Kelowna | Victoria | Squamish | Whistler | Pemberton