Jexx Posted October 12, 2009 Share Posted October 12, 2009 Hi I'm reading data from a database and this seems to work OK. Each system has an associated series of references.. Code: $dn = "cn=System"; $filter="(objectclass=*)"; $values = array('cn','telephone','id','intref','dataref','sysref'); $sr=ldap_list($ds, $dn, $filter, $values); $info = ldap_get_entries($ds, $sr); for ($n=0; $n<$info['count']; $n++) { $cn = $info[$n]['cn'][0]; $tele[$cn] = $info[$n]['telephone'][0]; $id[$cn] = $info[$n]['id'][0]; $intref[$cn] = $info[$n]['intref'][0]; $dataref[$cn] = $info[$n]['dataref'][0]; $sysref[$cn] = $info[$n]['sysref'][0]; } foreach ($tele as $key => $value) { echo $key . " - Phone: " . $value . " - ID: " . $id[$key] . " - intref: " . $intref[$key] . " - dataref: " . $dataref[$key]. " - sysref: " . $sysref[$key]. "<br>"; } What I'm trying to do is Code: if id = intref, or id = dataref or id = sysref then display intref or dataref or sysref in bold. Obviously I need to check to see if ID from any of the systems match any of the refs. I think that makes sense !! Quote Link to comment https://forums.phpfreaks.com/topic/177423-comparing-values/ Share on other sites More sharing options...
JonnoTheDev Posted October 12, 2009 Share Posted October 12, 2009 You can finish off: <?php foreach($tele as $key => $value) { echo $key." - Phone: ".$value." - ID: ".$id[$key]." - intref: ".(($id[$key] == $intref[$key]) ? "<strong>".$intref[$key]."</strong>" : $intref[$key])." - dataref: ".$dataref[$key]." - sysref: ".$sysref[$key]."<br>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/177423-comparing-values/#findComment-935502 Share on other sites More sharing options...
Jexx Posted October 13, 2009 Author Share Posted October 13, 2009 Thanks.. but that does seem to work It check the ID for each row against that row, not all the ID against all rows !! Any ideas ? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/177423-comparing-values/#findComment-936156 Share on other sites More sharing options...
mikesta707 Posted October 13, 2009 Share Posted October 13, 2009 did you just copy paste neil johnson's code? he said you can finish off for a reason. look at what he did here .(($id[$key] == $intref[$key]) ? "<strong>".$intref[$key]."</strong>" : $intref[$key]). and apply that logic where you need to Quote Link to comment https://forums.phpfreaks.com/topic/177423-comparing-values/#findComment-936159 Share on other sites More sharing options...
Jexx Posted October 13, 2009 Author Share Posted October 13, 2009 Hi I had spotted that.. but it only seems to match against ID 1 on row1, ID 2 on row 2 etc.. Not ID1 on rows 1,2,3,4 etc. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/177423-comparing-values/#findComment-936210 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.