lostndazed Posted July 25, 2006 Share Posted July 25, 2006 Hi, I have an expression that reads: if ($products_artist == 'NULL'){ $bestsellers_list .= '<tr><td class="infoBoxContents" valign="top">' . tep_row_number_format($rows) . '.</td><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . $best_sellers['products_name'] . '</a></td></tr>'; } else { $bestsellers_list .= '<tr><td class="infoBoxContents" valign="top">' . tep_row_number_format($rows) . '.</td><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . $best_sellers['products_artist'] . '<br />'. '(' . $best_sellers['products_name'] . ')</a></td></tr>'; } } I'm trying to say "if the field $products_artist is NULL or blank, then show this, if there is some text in $products_artist, then show this." It's ALWAYS showing the 2nd view. What am I doing wrong and how should I write it? Thanks for your insight. Link to comment Share on other sites More sharing options...
Jan Zonjee Posted July 25, 2006 Share Posted July 25, 2006 I'm trying to say "if the field $products_artist is NULL or blank, then show this, if there is some text in $products_artist, then show this." Does this work? if (!tep_not_null($products_artist)){ Link to comment Share on other sites More sharing options...
lostndazed Posted July 25, 2006 Author Share Posted July 25, 2006 Does this work? if (!tep_not_null($products_artist)){ Hm, that seems to be on the right track (thank you!), but now the 2nd part is not working/showing. Link to comment Share on other sites More sharing options...
lostndazed Posted July 25, 2006 Author Share Posted July 25, 2006 Ok, here's the code. Maybe I need to increment the rows? But I thought they were getting incremented? Because each row is showing up, but I can't seem to get the name/artist part to show up correctly. while ($best_sellers = tep_db_fetch_array($best_sellers_query)) { $rows++; if (!tep_not_null($products_artist)){ $bestsellers_list .= '<tr><td class="infoBoxContents" valign="top">' . tep_row_number_format($rows) . '.</td><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . $best_sellers['products_name'] . '</a></td></tr>'; } else { $bestsellers_list .= '<tr><td class="infoBoxContents" valign="top">' . tep_row_number_format($rows) . '.</td><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . $best_sellers['products_artist'] . '<br />'. '(' . $best_sellers['products_name'] . ')</a></td></tr>'; } } Link to comment Share on other sites More sharing options...
Jan Zonjee Posted July 25, 2006 Share Posted July 25, 2006 Perhaps: if (!tep_not_null($best_sellers['products_artist'])){ Link to comment Share on other sites More sharing options...
lostndazed Posted July 25, 2006 Author Share Posted July 25, 2006 Yah Jan7! That appears to have been the ticket! Seems to work great now. Thank you so much! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.