Jump to content

need to compare 2 tables before output


madcrazy1

Recommended Posts

PHP Version 5.2.2

Server version: 5.0.67

MySQL client version: 5.0.67

 

I have code below that works well, but now i want to exclude the output values of query "tid" from table "tbl_names" where a match is found in a column called "tid" in another table "tbl_exclude"

in other words, when the check boxes are created only the values that do not match

show.  can this be done? if so please include full code and i will try it and anounce result. Thank you.

 

$quer2=mysql_query("SELECT DISTINCT tid, LEFT(memn,7) AS SHORT_DESC FROM tbl_names where userid=$id order by tbl_names.memn ASC LIMIT 100");

 

while($noticia2 = mysql_fetch_array($quer2)) {

if($noticia2['tid']==@$id){echo "<td><input name='l2[]' type='checkbox' id='l2[]' value='$noticia2[tid]'> $noticia2[sHORT_DESC]..<br/></td>";}

else{echo "<td><input name='l2[]' type='checkbox' id='l2[]' value='$noticia2[tid]'> $noticia2[sHORT_DESC]..<br/></td>";}

Link to comment
https://forums.phpfreaks.com/topic/201205-need-to-compare-2-tables-before-output/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.