mreigle Posted March 6, 2006 Posted March 6, 2006 MOST IMPORTANTLY, I want to display the category name in <h1> tags in my header. I can get the category name to echo out just fine on the category pages (bottom of index.php... I'm still learning PHP if you don't notice) I'm guessing it's because I'm trying to put my PHP code and the category name has not been pulled from the database yet and stored in a variable so that I can echo it because I'm putting it at the top of the page on a different page. Can someone help me with this? I'm assuming it can be done with the stuff here, but it's got to be rearranged and I'm only to page 100 of my 900 page PHP and mysql book. heh $category_name_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES . " where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'"); $category_name = tep_db_fetch_array($category_name_query); if ($category_depth == 'nested') { echo $category_name;} Can someone just give me a hint? Secondly, I'm trying to get my page optimized for both IE and FF. Naturally, everything shows up fine in IE. When I access my site through Firefox, two main problems arise: I have a gap under one of my images that makes the whole page look weird. Is this a common problem? All of my other images seem to line up correctly. The image isn't in a nested table or anything and the borders for the image are set to 0. Also, all the cellpaddings and spacings are set to 0. Second problem, firefox does not want to load a font class for one of my main fonts. I've looked it over, over and over again. I have <font class="maint"> and in my stylesheet I have font.maint { font-size: 14pt; font-weight: bold; color: #333333; } Don't see what the problem is there, but apparently it doesnt want to load it. It gives me the following error: ------------ Selector expected. Ruleset ignored due to bad selector.1024.css (line 398) ------------
Guest Posted March 6, 2006 Posted March 6, 2006 you should have the query at the beginning of the php script (after the application_top.php inclusion) and fetch the category_name there. The header comes much later so you should be able to echo the categories name from the header using the same var. for the ff check the script for html errors first then make sure you do not run into some css elements that are specific to one browser or another.
mreigle Posted March 6, 2006 Author Posted March 6, 2006 Still having problems. When I do this: <?php $category_name_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = " . (int)$current_category_id ); $category_name = tep_db_fetch_array($category_name_query); if ($category_depth == 'nested') {echo $category_name['categories_name'];} ?> Nothing shows. Can someone see the problem?
Guest Posted March 6, 2006 Posted March 6, 2006 ....where categories_id = '" . (int)$current_category_id . "'");
mreigle Posted March 6, 2006 Author Posted March 6, 2006 Yay, my second usable PHP script: <?php $category_name_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = " . (int)$current_category_id ); $category_name = tep_db_fetch_array($category_name_query); if ((int)$current_category_id <= 0) {echo' <center><h1>Luxury Sheets & Bedding</h1></center>';} else echo '<center><h1>' . $category_name['categories_name'] . '</h1></center>'; ?>
mreigle Posted March 6, 2006 Author Posted March 6, 2006 Added language support: <?php $category_name_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = " . (int)$current_category_id . " and language_id = " . (int)$languages_id); $category_name = tep_db_fetch_array($category_name_query); if ((int)$current_category_id <= 0) {echo' <center><h1>Luxury Sheets & Bedding</h1></center>';} else echo '<center><h1>' . $category_name['categories_name'] . '</h1></center>'; ?>
mreigle Posted March 6, 2006 Author Posted March 6, 2006 How is that...? It seems to be working fine.
Guest Posted March 6, 2006 Posted March 6, 2006 yes this is the warning the query generates if you check with phpmyadmin. Extra: Impossible WHERE noticed after reading const tables
mreigle Posted March 6, 2006 Author Posted March 6, 2006 how do I see that warning? If i do: select categories_name from categories_description where categories_id = 42 and language_id = 1; it runs fine. Is there something wrong with my php syntax?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.