abs0lut Posted September 2, 2008 Share Posted September 2, 2008 <?php include 'conn.php'; $post = $_GET['post']; ?> <form method="post" name="formk" action="<?= $_SERVER['PHP_SELF']. '?' . $_SERVER['QUERY_STRING'] ?>"> <?php $result = mysql_query("SELECT cid, iqid, cost, usersid, warranty, othmsg FROM ctable WHERE postid=$post ORDER BY warranty"); while ($row = mysql_fetch_array($result)) { $arr[$row['iqid']][$row['usersid']] = $row['cost']; $arr2[$row['iqid']][$row['usersid']] = $row['cid']; $arr3[$row['iqid']][$row['usersid']] = $row['warranty']; $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])) { echo "<td width='10%'>".$arr[$iqid][$userid]."<input type='radio' name='iqid[$iqid]' value='{$arr2[$iqid][$userid]}'></td>"; } else echo "<td></td>"; } echo "</tr>"; } echo '<tr><td>Warranty:</td>'; foreach($uid as $userid) { echo '<td width=10%>'; echo $arr3[$iqid][$userid]; echo '</td>'; } echo '</tr>'; echo '</table>'; echo '<input type="submit" name="checkb" />'; echo'</form>'; } ?> I used order by to sort warranty, so that same warranty will be grouped together I need to put a border between different warranty, could you please help me? for example userid1 userid2 | userid3 iqid cost cost | cost iqid2 cost cost | cost iqid3 cost cost | cost 1year 1year | 2years Link to comment https://forums.phpfreaks.com/topic/122318-border-between-different-warranty/ Share on other sites More sharing options...
Third_Degree Posted September 2, 2008 Share Posted September 2, 2008 add an AND `warranty`='1year' to your clause and get rid of the order by and do more than one query. OR use an if statement to sort the warranties, put each type in a separate array and then print these arrays off. Sorry if these solutions are confusing in wording, I'm too tired right now to write out the code. If you still need help, when i get the time i'll sample the code. Link to comment https://forums.phpfreaks.com/topic/122318-border-between-different-warranty/#findComment-631673 Share on other sites More sharing options...
abs0lut Posted September 2, 2008 Author Share Posted September 2, 2008 I don't want to do more than one query. I want the second, but I don't know how to do it. Could you please help me? Link to comment https://forums.phpfreaks.com/topic/122318-border-between-different-warranty/#findComment-632320 Share on other sites More sharing options...
abs0lut Posted September 4, 2008 Author Share Posted September 4, 2008 bump, please help me Link to comment https://forums.phpfreaks.com/topic/122318-border-between-different-warranty/#findComment-633473 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.