abs0lut Posted October 8, 2008 Share Posted October 8, 2008 <?php include 'conn.php'; $q= mysql_query("SELECT min(cost) as mincost, iqid FROM ctable GROUP BY iqid, warranty") or die(mysql_error()); while($row = mysql_fetch_array($q)){ $mincost[]=$row['mincost']; } ?> <form method="post" name="form1" action="<?= $_SERVER['PHP_SELF']. '?' . $_SERVER['QUERY_STRING'] ?>"> <?php $result = mysql_query("SELECT cid, iqid, cost, usersid, warranty, othmsg FROM ctable ORDER BY warranty"); while ($row = mysql_fetch_array($result)) { $arr[$row['iqid']][$row['usersid']] = $row['cost']; $arr2[$row['iqid']][$row['usersid']] = $row['cid']; $uid[] = $row['usersid']; } $uid = array_unique($uid); $qid = array_keys($arr); echo '<table><tr><td></td>'; foreach($uid as $userid) echo "<td>$userid</td>"; echo '</tr>'; foreach($qid as $iqid) { echo "<tr><td>$iqid</td>"; foreach($uid as $userid) { if (isset($arr[$iqid][$userid])) { if($arr[$iqid][$userid]==$mincost){ echo "<td bgcolor='#FF0000'>".$arr[$iqid][$userid]." <input type='radio' name='iqid[$iqid]' value='{$arr2[$iqid][$userid]}'></td>"; } else{ echo "<td>".$arr[$iqid][$userid]." <input type='radio' name='iqid[$iqid]' value='{$arr2[$iqid][$userid]}'></td>"; } } else echo "<td></td>"; } echo "</tr>"; } ?> </table> <input type="submit" /> </form> <?php } ?> please help me display the background color #FF0000 for every lowest cost Link to comment https://forums.phpfreaks.com/topic/127619-problem-displaying-bgcolor/ Share on other sites More sharing options...
DarkWater Posted October 8, 2008 Share Posted October 8, 2008 What does the code currently do? Link to comment https://forums.phpfreaks.com/topic/127619-problem-displaying-bgcolor/#findComment-660333 Share on other sites More sharing options...
abs0lut Posted October 9, 2008 Author Share Posted October 9, 2008 output: http://img137.imageshack.us/my.php?image=phpll3.jpg could you please help me? Link to comment https://forums.phpfreaks.com/topic/127619-problem-displaying-bgcolor/#findComment-660672 Share on other sites More sharing options...
JasonLewis Posted October 9, 2008 Share Posted October 9, 2008 From the looks of it, $mincost is an array and you are trying to compare a string/integer to an array, which would never work out. Maybe you should re-think your code a bit. Link to comment https://forums.phpfreaks.com/topic/127619-problem-displaying-bgcolor/#findComment-660686 Share on other sites More sharing options...
abs0lut Posted October 9, 2008 Author Share Posted October 9, 2008 it should be what? Link to comment https://forums.phpfreaks.com/topic/127619-problem-displaying-bgcolor/#findComment-661381 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.