gaspower Posted December 15, 2010 Share Posted December 15, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/221759-help-adding-test-to-output/ Share on other sites More sharing options...
ManiacDan Posted December 15, 2010 Share Posted December 15, 2010 $category_list = " "; That is where the string is started. Change it to: $category_list = "<h1>Fits these products</h1>"; -Dan Quote Link to comment https://forums.phpfreaks.com/topic/221759-help-adding-test-to-output/#findComment-1147660 Share on other sites More sharing options...
solon Posted December 15, 2010 Share Posted December 15, 2010 let's say that your output variable is like: $output = "Categories..."; if you want to output "Categories... Fits These Products" you can do the following: $output = $output." Fits These Products"; i hope i understood correctly Quote Link to comment https://forums.phpfreaks.com/topic/221759-help-adding-test-to-output/#findComment-1147661 Share on other sites More sharing options...
gaspower Posted December 15, 2010 Author Share Posted December 15, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/221759-help-adding-test-to-output/#findComment-1147675 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.