Jump to content

JOIN where field is empty


wjhulzebosch

Recommended Posts

Hi, i've got a website with images on it. You can tag the images, and after that, you can view images with a certain tag. I have the following tables:

table:filelist

-------------------------------------

picnum | filename | complaint

-------------------------------------

1          | fam.jpg  | 0

2          | dog.jpg  | 0

3          | cat.jpg    | 0

 

table: tags

-----------------------------

picnum | tag          | ok

-----------------------------

1          | Family      | 1

1          | Jonathan | 1

2          | Dog        | 1

2          | Animals    | 1

 

 

This works with this piece of code:

		$result_n = mysql_query(
		"SELECT picnum, filename, tag 
		FROM filelist 
		LEFT JOIN tags ON (picnum = tags_picnum) 
		WHERE tag='$tag' AND ok='1' AND complaint=0");

 

Now, i want to create a page where i can see all images, without a tag (in this example, image 3, cat.jpg). Is the above piece of code easy to convert to find images that have no tag associated with them? How can i easily find images without a tag?

 

Ty!

Link to comment
https://forums.phpfreaks.com/topic/248277-join-where-field-is-empty/
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.