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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.