Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Logical error. What am I doing wrong here?


lostndazed

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...