Jump to content

Recommended Posts

Hello,

Having trouble inserting plain text to the output of this php. The code below outputs categories in the database which pertain to certain products in this manner,

 

cat1, cat2, cat3, cat4, cat5 etc.

 

What I want to add is the text "Fits These Products" this to the output,

 

Fits These Products

cat1, cat2, cat3, cat4, cat5 etc

 

 $lc_align = '';
		if(isset($HTTP_GET_VARS['language']))
		{
		  $env_language = $HTTP_GET_VARS['language'];
		  $language_query = tep_db_query("select languages_id from ". TABLE_LANGUAGES . " where code ='" . $env_language . "'");
		  $language_arr = tep_db_fetch_array($language_query);
		  $language_id = $language_arr['languages_id'];
		}
		else
		{
	      $language_id = (int)$languages_id;
		}
	      $products_to_catagories_query = tep_db_query("SELECT categories_name FROM ". TABLE_PRODUCTS_TO_CATEGORIES ." p2c, ". TABLE_CATEGORIES_DESCRIPTION ." cd WHERE p2c.products_id = " . (int)$listing[$x]['products_id'] . " and p2c.categories_id = cd.categories_id and language_id ='".(int)$language_id."'");


$category_list = " ";
            do
              {
			if($category_list != " ")

				$category_list .=" , ";
			else
                   $products_to_categories_array = tep_db_fetch_array($products_to_catagories_query);
                $category_list .= $products_to_categories_array['categories_name'];
               }
            while($products_to_categories_array = tep_db_fetch_array($products_to_catagories_query));
	    $category_list .="<br><br>";

 

Thank you JR

Link to comment
https://forums.phpfreaks.com/topic/221759-help-adding-test-to-output/
Share on other sites

Hello Dan and Solon,

 

Thank you both for the suggestions. I tried the ($category_list = "<h1>Fits these products</h1>";), but when I do this method, I get a double (,,) before the output. So, it looks like this ,,cat1, cat2, cat3, cat4, cat5.

 

Thanks JR

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.