flyboeing Posted November 21, 2012 Share Posted November 21, 2012 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 Link to comment https://forums.phpfreaks.com/topic/270967-compare-2-tables-color-red-if-not-exist-else-normal/ Share on other sites More sharing options...
flyboeing Posted November 21, 2012 Author Share Posted November 21, 2012 Here an image of what I mean: Link to comment https://forums.phpfreaks.com/topic/270967-compare-2-tables-color-red-if-not-exist-else-normal/#findComment-1394008 Share on other sites More sharing options...
Christian F. Posted November 21, 2012 Share Posted November 21, 2012 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. Link to comment https://forums.phpfreaks.com/topic/270967-compare-2-tables-color-red-if-not-exist-else-normal/#findComment-1394035 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.