Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help with simple db query


AJRYAN

Recommended Posts

 case 'PRODUCT_LIST_PRICE':
           $lc_align = 'center';

[b]	$price_status_query = tep_db_query("select * from products where products_id =" . $listing['products_id']) .")";
2nd attempt >>  $price_status_query = tep_db_query("select * from products where products_id =" . $listing['products_id'] . '")   ;[/b]

		$price_status_results = tep_db_fetch_array($price_status_query);
		$products_price_status  =  $price_status_results['products_price_status'];

	 if (tep_not_null($listing['specials_new_products_price'])) {
		  $lc_text = ' <s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s><br>View In Cart  ';
                if ($products_price_status != 0) {
		        $products_price = ' <s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</s><br>  <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '"><span class="productSpecialPrice">' . $special_price . '</span></a><br>';  
  		        $lc_text = ' ' . $products_price . ' ';
   	    }  

		}

		else{
             $lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';
           }

 

I don't know if I'm just daft or what, but I cannot for the life of me get this to work. Maybe I'm just too tired.

 

I am trying to affect how the price is displayed in product_listings based on the products_price_status field in the products table. Pretty obvious, huh? Anyhow, I cannot seem to get it to return any results. Currently the code that is there looks like it should error out, but it does not, but does not return any valid results either.

>> $price_status_query = tep_db_query("select * from products where products_id =" . $listing['products_id']) .")"; <<

 

The next line seems like it should work syntactically, but it errors out.

>> $price_status_query = tep_db_query("select * from products where products_id =' . $listing['products_id'] . '")'; <<

 

I have tried numerous permutations of this and just can't get it to work.

 

If someone could help I would surely appreciate it.

 

Thanks in advance

Link to comment
Share on other sites

 case 'PRODUCT_LIST_PRICE':
           $lc_align = 'center';

[b]	$price_status_query = tep_db_query("select * from products where products_id =" . $listing['products_id']) .")";
2nd attempt >>  $price_status_query = tep_db_query("select * from products where products_id =" . $listing['products_id'] . '")   ;[/b]

		$price_status_results = tep_db_fetch_array($price_status_query);
		$products_price_status  =  $price_status_results['products_price_status'];

	 if (tep_not_null($listing['specials_new_products_price'])) {
		  $lc_text = ' <s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s><br>View In Cart  ';
                if ($products_price_status != 0) {
		        $products_price = ' <s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</s><br>  <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '"><span class="productSpecialPrice">' . $special_price . '</span></a><br>';  
  		        $lc_text = ' ' . $products_price . ' ';
   	    }  

		}

		else{
             $lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';
           }

 

I don't know if I'm just daft or what, but I cannot for the life of me get this to work. Maybe I'm just too tired.

 

I am trying to affect how the price is displayed in product_listings based on the products_price_status field in the products table. Pretty obvious, huh? Anyhow, I cannot seem to get it to return any results. Currently the code that is there looks like it should error out, but it does not, but does not return any valid results either.

>> $price_status_query = tep_db_query("select * from products where products_id =" . $listing['products_id']) .")"; <<

 

The next line seems like it should work syntactically, but it errors out.

>> $price_status_query = tep_db_query("select * from products where products_id =' . $listing['products_id'] . '")'; <<

 

I have tried numerous permutations of this and just can't get it to work.

 

If someone could help I would surely appreciate it.

 

Thanks in advance

 

 

AJ,

It doesn't appear that you have the text delimited correctly with the " and ' s. Give this a shot

$price_status_query = tep_db_query("select * from products where products_id ='" . $listing['products_id'] . "'");

 

Frank

Link to comment
Share on other sites

AJ,

It doesn't appear that you have the text delimited correctly with the " and ' s. Give this a shot

$price_status_query = tep_db_query("select * from products where products_id ='" . $listing['products_id'] . "'");

 

Frank

 

 

Frank, you're a gem - it works perfectly. I always have trouble with those darn "'s and ''s!!

 

Thanks so much!!

 

AJ

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...