Jump to content

Compare 2 Tables: Color Red If Not Exist, Else Normal


flyboeing

Recommended Posts

Hello all,

 

I have 2 tables in my database. One is with all the Airlines, the other one is a table that contains the title of an page (page title is exactly the same as the Airline name).

For myself I want to make an overview of which airline I have added to my website (so where the page title = Airline name). If this page title does not match (wrong name or the page title does not exist) I want to see that (for example in red). (so if the page title = Airline name, the text is normal, does the page title not exist or typt wrong, show in red (CSS or something).

 

So I have to compare two tables (I think), but how do I do this?

 

I tried an if-else statement, but it will only show the entire list of page titles or only shows the else statement.

 

I hope someone can help me with this :)

 

Kind regards,

Ruud

Use a LEFT JOIN to get the title, and in the loop check if the title is set. Depending upon whether or not the title is set, you can assign a classname to a variable, which you then use when constructing the HTML line for said airline.

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.