abs0lut Posted August 16, 2008 Share Posted August 16, 2008 <?php session_start(); include 'conn.php'; $post = $_GET['post']; $slected = array(); if(isset($_POST['checkb'])){ if(count($_POST['cid']) > 0){ foreach($_POST['cid'] as $awrd) { $result = mysql_query("UPDATE ctable SET award='yes' WHERE id='$awrd'") or die(mysql_error()); $slected[] = $awrd; } } } else{ ?> <form method="post" name="formk" action="<?= $_SERVER['PHP_SELF']. '?' . $_SERVER['QUERY_STRING'] ?>"> <?php $result = mysql_query("SELECT cid, iqid, cost, usersid FROM ctable WHERE post=$post"); 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])) { echo "<td>".$arr[$iqid][$userid]."<input type='checkbox' name='cid[]' value='{$arr2[$iqid][$userid]}'></td>"; } else echo "<td></td>"; } echo "</tr>"; } echo '</table>'; echo '<input type="submit" name="checkb" />'; echo'</form>'; } ?> I need to check if the $iqid of $arr2[$iqid][$userid] is equal to other, could you please help me? Quote Link to comment https://forums.phpfreaks.com/topic/119953-check-if/ Share on other sites More sharing options...
budimir Posted August 16, 2008 Share Posted August 16, 2008 if ($iqid == $arr2[$iqid][$userid]){ continue with your code.... } Quote Link to comment https://forums.phpfreaks.com/topic/119953-check-if/#findComment-617950 Share on other sites More sharing options...
abs0lut Posted August 16, 2008 Author Share Posted August 16, 2008 please read my code... Quote Link to comment https://forums.phpfreaks.com/topic/119953-check-if/#findComment-617964 Share on other sites More sharing options...
abs0lut Posted August 18, 2008 Author Share Posted August 18, 2008 http://img179.imageshack.us/my.php?image=cb3gh2.jpg I need to display an error message "you have checked same iqid", when the users checks 2 or more cost in iqid1 when the users checks 2 or more cost in iqid2 and so on.. please help me... Quote Link to comment https://forums.phpfreaks.com/topic/119953-check-if/#findComment-619091 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.