TecTao Posted October 2, 2014 Share Posted October 2, 2014 A select query I've written joins three tables. The query works fine, pulling up a users table, a table for specials advertising that are entered by members, a and a third table the identivies members who have joined a customer application. A page displays listing all the entries who have joined the customer application, their names, address, etc display but if they have not set up their special advertising, then the fields for that table display NULL. I have tried an If and an ifelse to not display text (you can see in the code the HTML Hours of Operation: and Specials:). Thee field I am using to differentiate is "m_primeID", it is an intiger field. The if statement I've written is follows. if( $row["$m_primeID"] == 'NULL' ) { $company .= ""; } elseif( $row["$m_primeID"] <> 'NULL' ) { $company .= "<b>Hours of Operation:</b><br>" . ($row["m_coupon_title"]) . "<br /><br />\n"; $company .= "<b>Special:</b><br>" .($row["m_coupon_desc"]) . "<br /><br />\n"; } Here is a screen shot of part of the joined tables. This screen shot show the Null on the joined tables that don't have customer advertising set up. Any Ideas Quote Link to comment Share on other sites More sharing options...
requinix Posted October 2, 2014 Share Posted October 2, 2014 (edited) The value isn't actually the string "NULL". It's the value null itself. Forget the elseif and just do if( $row["$m_primeID"] ) { $company .= "<b>Hours of Operation:</b><br>" . ($row["m_coupon_title"]) . "<br /><br />\n"; $company .= "<b>Special:</b><br>" .($row["m_coupon_desc"]) . "<br /><br />\n"; }[edit] And I doubt you mean to use a variable $m_primeID... Edited October 2, 2014 by requinix Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.