PHP - Sidebar Menu Not Showing 4th Subcategories
Hello to you all, Firstly, I have to admit - I know nothing about PHP coding. That said, I tried to make something work, kinda failed, partly done it, but it's not the way I need it. Let me explain. I'm working on some basic stuff on a woocommerce website. I changed the category tree of the products and now there are categories nested quite deep. Like - Parent category -> Subcategory -> Nested category -> Further nested category. That last piece wasn't showing on the sidebar, so I digged and found the PHP code responsible for showing categories. Upon finding the "Nested category" code, I simply copy-pasted it in a right place and then added CSS "display:block" rule. Now, the "Further nested category" is showing, when "Nested category" is active. But, here are the problems: 1. If there are multiple categories of that last depth for various "Nested categories", they are all showing; 2. When I click on a link of any "Further nested category", the page redirects correctly and shows all the required products, but the category tree is shrinking to "Parent categories" only. The store url is: https://skorpion.info.pl/sklep/. The problem #1 can be seen he https://skorpion.info.pl/kategoria/naczynia-i-przybory/naczynia-kuchenne-naczynia-i-przybory/ - as you can see, both "Garnki" and "Patelnie" nested categories show all of their consecutive further nested subcategories. The problem number two can be seen he https://skorpion.info.pl/kategoria/naczynia-i-przybory/naczynia-kuchenne-naczynia-i-przybory/patelnie-naczynia-kuchenne-naczynia-i-przybory/patelnie-aluminiowe/. The categories should remain visible. Let me post the code below, I'll mark with a comment the block I copy-pasted. I really hope someone can help me here, I would be massively thankful. Cheers! <aside class="sidebarWrapper"> <?php $types = array( 'hendi' => 'Hendi', 'stalgast' => 'Stalgast', 'bartscher' => 'Bartscher', 'kromet' => 'Kromet', 'hiendkitchen' => 'Hiendkitchen', ); ?> <ul class="parent-list"> <?php foreach ($types as $type => $value) : ?> <li> <a href="<?php echo home_url(); ?>/hurtownie/<?php echo $type; ?>"><?php echo $value; ?></a> </li> <?php endforeach; ?> </ul> <h2 class="title"> Kategorie <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 492.004 492.004" style="enable-background:new 0 0 492.004 492.004;" xml:space="preserve" width="512px" height="512px"> <g> <g> <g> <path d="M382.678,226.804L163.73,7.86C158.666,2.792,151.906,0,144.698,0s-13.968,2.792-19.032,7.86l-16.124,16.12 c-10.492,10.504-10.492,27.576,0,38.064L293.398,245.9l-184.06,184.06c-5.064,5.068-7.86,11.824-7.86,19.028 c0,7.212,2.796,13.968,7.86,19.04l16.124,16.116c5.068,5.068,11.824,7.86,19.032,7.86s13.968-2.792,19.032-7.86L382.678,265 c5.076-5.084,7.864-11.872,7.848-19.088C390.542,238.668,387.754,231.884,382.678,226.804z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#F1B63E" /> </g> </g> </g> </svg> </h2> <div class="slideDown-wrapper"> <?php $cate = get_queried_object(); $cateID = $cate->term_id; $cateParentID = $cate->parent; $mainCateParentObject = get_term($cateParentID); $mainCateParentID = $mainCateParentObject->parent; $args = array( 'taxonomy' => 'product_cat', 'hide_empty' => false, 'parent' => 0, 'orderby' => 'title', 'order' => 'asc' ); $product_cat = get_terms($args); foreach ($product_cat as $parent_product_cat) : ?> <ul class="parent-list"> <li class="<?php if ($parent_product_cat->term_id == $cateID || $parent_product_cat->term_id == $cateParentID || $parent_product_cat->term_id == $mainCateParentID) echo 'active'; ?>"> <a href="<?php echo get_term_link($parent_product_cat->term_id); ?>"> <?php echo $parent_product_cat->name; ?> </a> <?php if ($parent_product_cat->term_id == $cateID || $parent_product_cat->term_id == $cateParentID || $parent_product_cat->term_id == $mainCateParentID) : ?> <ul class="child-list"> <?php $child_args = array( 'taxonomy' => 'product_cat', 'hide_empty' => false, 'parent' => $parent_product_cat->term_id ); $child_product_cats = get_terms($child_args); foreach ($child_product_cats as $child_product_cat) : ?> <li class="<?php if ($child_product_cat->term_id == $cateID || $child_product_cat->term_id == $cateParentID) echo 'active'; ?>"> <a href="<?php echo get_term_link($child_product_cat->term_id); ?>"> <?php if ($child_product_cat->term_id == $cateID) echo '<strong>'; ?> <?php echo $child_product_cat->name; ?> <?php if ($child_product_cat->term_id == $cateID) echo '</strong>'; ?> </a> <ul class="child-list"> <?php $child_args = array( 'taxonomy' => 'product_cat', 'hide_empty' => false, 'parent' => $child_product_cat->term_id ); $child_product_cats = get_terms($child_args); foreach ($child_product_cats as $child_product_cat) : ?> <li> <a href="<?php echo get_term_link($child_product_cat->term_id); ?>"> <?php if ($child_product_cat->term_id == $cateID) echo '<strong>'; ?> <?php echo $child_product_cat->name; ?> <?php if ($child_product_cat->term_id == $cateID) echo '</strong>'; ?> </a> <!-- COPY-PASTED CODE FROM ABOVE--> <!-- --> <!-- --> <ul class="child-list" id="child-4-nest"> <?php $child_args = array( 'taxonomy' => 'product_cat', 'hide_empty' => false, 'parent' => $child_product_cat->term_id ); $child_product_cats = get_terms($child_args); foreach ($child_product_cats as $child_product_cat) : ?> <li> <a href="<?php echo get_term_link($child_product_cat->term_id); ?>"> <?php if ($child_product_cat->term_id == $cateID) echo '<strong>'; ?> <?php echo $child_product_cat->name; ?> <?php if ($child_product_cat->term_id == $cateID) echo '</strong>'; ?> </a> </li> <?php endforeach; ?> </ul> <!-- END OF COPY-PASTED CODE--> <!-- --> <!-- --> </li> <?php endforeach; ?> </ul> </li> <?php endforeach; ?> </ul> <?php endif; ?> </li> </ul> <?php endforeach; ?> </div> </aside> <aside class="saleProductsWrapper container p-0"> <h2 class="title">Promocje</h2> <div class="row"> <?php $cate = get_queried_object(); $cateID = $cate->term_id; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $loop = new WP_Query(array( 'post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => '1', 'meta_query' => array( array( 'key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric' ) ), 'orderby' => 'rand' )); while ($loop->have_posts()) : $loop->the_post(); ?> <div class="col-lg-12"> <?php get_template_part('template-parts/product'); ?> </div> <?php endwhile; wp_reset_query(); ?> </div> </aside>
Similar TutorialsHello, I am doing (well trying to do, anyway) a script where I need to follow a link, and through its source (file_get_contents) i need to to follow each "category" and into its "subcategory" (and sometimes even SUBsubcategory). Lets say the first in the menu is called "Catfood", the second "Dogfood", you click on "Catfood" and you get a submenu with for example "Whiskas", another one called "Purina Pro", and you click "Whiskas" and you see a list of food called for example "Whiskas Junior Chicken" and "Whiskas Junior Fish". then after i have followed "Whiskas", i need to go back and follow "Purina Pro". then after "Purina Pro" i need to go back to "Dogfood" and do the same to its submenu + subsubmenu + food menu.. so yeah, thats pretty much it basically.. i have already used wget for windows to download the entire website to not put load on it all the time when trying stuff out.. i use RegEx to find categories, their products and price, and i got all that covered, it's just that the website isn't built very friendly for using Regex to tie lets say "Purina Pro" with being in the "Catfood" category, so i have to go through all categories and subcats to save the categories in maybe an array, and bind the subcategories to the main category ("Purina Pro" with "Catfood") i hope this all doesn't sound too errr weird lol, any help is very much appreciated even enough to just get me started on my own! =) ****************** EDIT BELOW: The menu looks a bit like this, though it's orinally not about cat or dogfood, they are just examples Catfood - Whiskas - Purina Pro Dogfood - Royal Canin - Puppy food - Grown - Senior - Bozita Robur Hello,
New to php&mysql here and need a little help.
I want to make category list with sub-categories and sub-sub-categories. The goal is when I load website I will see full list with master(root)categories . Then when I click some categories should load sub-category and if I click on sub-category should load sub-sub-category. Something like this:
Computers -> Motherboards -> Model 1 -> Model 2 -> etc. Monitors -> Model 1 -> Model 2As you can see max level of sub-category will be 2+root. Here is the perfect example what I want to do http://3docean.net/category I don't understand(know) also how exactly will look my database table? How to store categories and sub-categories. I don't want someone to write full code etc as I want to learn it but will be great if you guys can show me some good tutorial how to make it mostly database structure. Thank you in advance! p.s. Sorry for my English! I have two tables subcat and category structure subcat id_subcat|id_of_cat|subcat_name| and for main categories ID_cat|cat_name| now what I want to display them as Main category subcategory1 subcategory2 Main category2 subcategoryX etc... Here's the code I'm using but doesn't work,it doesn't display anything. <?php $query = " SELECT ID_cat, id_subcat, subcat_name, cat_name FROM subcat, category WHERE ID_cat=id_subcat"; $result = mysql_query($sql); $lastCat = null; while($row = mysql_fetch_assoc($result)) { # Check if you need to print the category_name if($lastCat != $row['ID_cat']) { # Not the same category as the last one! # Print it and save the ID $lastCat = $row['ID_cat']; echo "<br />". $row['ID_cat']; } # Print the sub category echo "<br />". $row['subcat_name']; } ?> Hey all, If I want to have a category which can have subcategories, which in turn can have its own subcategories or belong to the parent category, and the subcategories can have more than one parent categories, is the most effective way to design this is to create a categories table and categories_join table where the categories table has a foreign key categories_join_id linking it to the categories_join table and the categories_join table has a field called parent_id which associates with the primary key of the categories table, therefore allowing me to have multiple subcategories to one category: categories_join table id parent_id 1 2 1 3 categories table id categories_join_id 1 1 2 2 3 3 So from the example above, the first category has two parents, category 2 and category 3. As an alternative option, in this post: http://stackoverflow.com/questions/5384183/database-design-question-categories-subcategories The second answer down mentions to use recursive programming? But he doesn't give an example of what he means. Is he saying you have a function call itself passing it parameters as to what the parent should be: function getParent($category,$parents = array()){ } Thanks for response. Something is wrong with this drop down form menu. The name of the option appears and works well however the value does not seem to work. Any ideas? Thanks <?php include("cxn.php"); $query = "SELECT manufacturer FROM list ORDER BY manufacturer ASC"; $result = mysqli_query($cxn,$query) or die(mysqli_error()); ?> <select name="manufacturer" id="manufacturer"> <option value="" selected="selected">Select a Manufacturer..</option>"; <?php while($row = mysqli_fetch_row($result)){ echo "<option value=\"".$row[0]."\">".$row[0]."</option>"; // SHOWS ALL MANUFACTURERS CURRENTLY ADVERTISED WITH THE NUMBER OF ADVERTS NEXT TO THE MANUFACTURER } ?> This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=327455.0 Hello: I have a SELECT dropdown menu that works like this: Code: [Select] <?php $states_arr = array('AL'=>"Alabama",'AK'=>"Alaska",'AZ'=>"Arizona",'AR'=>"Arkansas",'CA'=>"California",'CO'=>"Colorado",'CT'=>"Connecticut",'DE'=>"Delaware",'DC'=>"District Of Columbia",'FL'=>"Florida",'GA'=>"Georgia",'HI'=>"Hawaii",'ID'=>"Idaho",'IL'=>"Illinois", 'IN'=>"Indiana", 'IA'=>"Iowa", 'KS'=>"Kansas",'KY'=>"Kentucky",'LA'=>"Louisiana",'ME'=>"Maine",'MD'=>"Maryland", 'MA'=>"Massachusetts",'MI'=>"Michigan",'MN'=>"Minnesota",'MS'=>"Mississippi",'MO'=>"Missouri",'MT'=>"Montana",'NE'=>"Nebraska",'NV'=>"Nevada",'NH'=>"New Hampshire",'NJ'=>"New Jersey",'NM'=>"New Mexico",'NY'=>"New York",'NC'=>"North Carolina",'ND'=>"North Dakota",'OH'=>"Ohio",'OK'=>"Oklahoma", 'OR'=>"Oregon",'PA'=>"Pennsylvania",'RI'=>"Rhode Island",'SC'=>"South Carolina",'SD'=>"South Dakota",'TN'=>"Tennessee",'TX'=>"Texas",'UT'=>"Utah",'VT'=>"Vermont",'VA'=>"Virginia",'WA'=>"Washington",'WV'=>"West Virginia",'WI'=>"Wisconsin",'WY'=>"Wyoming"); function showOptionsDrop($array){ $string = ''; foreach($array as $k => $v){ $string .= '<option value="'.$k.'"'.$s.'>'.$v.'</option>'."\n"; } return $string; } ?> <form> <select name="states"> <option value="0">Choose a state</option> <?php echo showOptionsDrop($states_arr); ?> </select> </form> I would like to show all the towns/zipcodes for each individual state with an "onchange" from the SELECT menu. The table is called "zip_codes" and the City/Zip Codes are called "city" and "zip" What I would like to do is display them as links, so a user can click into each town and either create a new entry (a restaurant) or update an existing entry. What would be the best approach for this? I appreciate the help. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <?php //MySQL Database Connect include 'sqlconnect.php'; ?> <select name="aktivitet" id="aktivitet"> <?php //MySQL Database Connect include 'sqlconnect.php'; $sql = mysql_query("SELECT title FROM aktiviteter"); while ($row = mysql_fetch_array($sql)){ echo "<option value=\"owner1\">" . $row['title'] . "</option>"; } ?> </select> </body> </html>why dosnt this work?, if you cant see what i want to happen, ill post an explaination I am pretty new to PHP and am trying to create a simple (so I assumed) page to takes data from one html page(works fine) and updates a MYSQL Database. I am getting no error message, but the connect string down to the end of the body section is showing up as plain text in my browser window. I do not know how to correct this. I have tried using two different types of connect strings and have verified my names from the HTML page are the same as listed within the php page. Suggestions on what I need to look for to correct would be great. I have looked online, but so far all I am getting is how to connect, or how to create a comment, so I thought I would try here. Thank you for any assistance I may get!! - Amy - Code: [Select] <body><font color="006600"> <div style="background-color:#f9f9dd;"> <fieldset> <h1>Asset Entry Results</h1> <?php // create short variable names $tag=$_POST['tag']; $serial=$_POST['serial']; $category=$_POST['category']; $status=$_POST['status']; $branch=$_POST['branch']; $comments=$_POST['comments']; if (!$tag || !$serial || !$category || !$status || !$branch) { echo "You have not entered all the required details.<br />" ."Please go back and try again."; exit; } if (!get_magic_quotes_gpc()) { $tag = addslashes($tag); $serial = addslashes($serial); $category = addslashes($category); $status = addslashes($status); $branch = addslashes($branch); $comments = addslashes($comments); } //@ $db = new mysqli('localhost', 'id', 'pw', 'inventory'); $db = DBI->connect("dbi:mysql:inventory:localhost","id","pw") or die("couldnt connect to database"); $query = "insert into assets values ('".$serial."', '".$tag."', '".$branch."', '".$status."', '".$category."', '".$comments."')"; $result = $db->query($query); if ($result) { echo $db->affected_rows." asset inserted into Inventory."; } else { echo "An error has occurred. The item was not added."; } $db->close(); ?> </fieldset> </div> </body> Hello there, this is a really noob question, but I've no idea on how to make it work without making everything messy and crappy. I have one SQL table called categories, and another called subcategories. Inside the subcategories table there's a field named 'parent' that will link it to the correspondent category, so it should look something like this in html: Code: [Select] <ul> <li>Category <ul> <li>Subcategory</li> </ul> </li> </ul> Would you please give this poor guy a hand? =) Anyone can help me? <?php $tbl_name="menu"; $kategorije = mysql_query("SELECT * FROM $tbl_name WHERE Left(menu_name, 1) BETWEEN 'A' AND 'M' ORDER BY menu_name ASC"); if (!$kategorije) { die("Database query failed: " . mysql_error()); } while ($row=mysql_fetch_array( $kategorije )) { echo "<div id=lista-header><h4>{$row["menu_name"]}</h4></div>"; $id_sub=$row['id_menu']; $podkategorije = mysql_query("SELECT * FROM submenu WHERE id_menu=$id_sub ORDER BY sub_name ASC", $connection); if (!$podkategorije) { die("Database query failed: " . mysql_error()); } echo "<ul class=\"pod\">"; while ($pod=mysql_fetch_array( $podkategorije )) { echo "<li><a href=index.php?=podkate?".$pod["id_sub"]." class=black>{$pod["sub_name"]}</a><hr size=1 align=left width=100px color=#cccccc></li>"; } echo "</ul>"; } ?> In this way, I get list with categories and hes subcategories. How to count how many subcategories have each categories, and count how many articles have each categories? Example (I wanna get this kind of look): Categories name (3) subcategoriesname (2) subcategoriesname (4) subcategoriesname (7) Categories name (5) subcategoriesname (1) subcategoriesname (14) subcategoriesname (9) subcategoriesname (2) subcategoriesname ( Categories name (2) subcategoriesname (28) subcategoriesname (17) Where the numbers represent how many categories and sub-items have articles For a college assignment I was required to make a website. It is after getting graded but I would like to continue to at least try to improve my site. One of the problems I had was the height of the sidebars. I solved the problem by using a javascript script, but I am wondering if it can be done with php? Hi All,
Am sure this is simple but can't work it out. I have the following which creates 3 menus:
<p>Drag items from one menu to another</p> <table> <tr> <td valign="top">Menu 1</td> <td valign="top">Menu 2</td> <td valign="top">Menu 3</td> </tr> <tr> <td valign="top"> <ul class="sortable" id="menu1"> <li id="id_1">Item 1</li> <li id="id_2">Item 2</li> </ul> </td> <td valign="top"> <ul class="sortable" id="menu2"> <li id="id_3">Item 3</li> <li id="id_4">Item 4</li> </ul> </td> <td valign="top"> <ul class="sortable" id="menu3"> <li id="id_5">Item 5</li> <li id="id_6">Item 6</li> </ul> </td> </tr> </table>This uses the following to show an array of each menu: $(function() { $("ul.sortable").sortable({ connectWith: '.sortable', update: function(event, ui) { $('#menu_choice').empty().html( $('.sortable').serial() ); } }); }); (function($) { $.fn.serial = function() { var array = []; var $elem = $(this); $elem.each(function(i) { var menu = this.id; $('li', this).each(function(e) { array.push( menu + '['+e+']=' + this.id ); }); }); return array.join('&'); } })(jQuery);What I'd like is to simply grab the values of menu 1 only, as the array shows all menus. What am I doing wrong as can't seem to just return menu1. Going forward, I then want to store the returned array into a PHP cookie if this is possible? Many thanks So i have a <drop down> menu, and a <nav> menu on my left side of the page. I have a problem when i click at the first column of my drop down menu and it explores submenu, the submenu mixes with the nav menu that is under the drop down menu on the left. i could solve it with margin-top of the nav menu but i don't like the empty space beetwen them. I tried with putting overflow:visible; in CSS of my dropdown menu but it is still the same. drop down menu is seen but there is stil seen nav menu under and they are mixed. So basicly i want my dropdown menu to be priority, so when i clicks on my first column (only first column is problem because there under is nav menu the other are open nice) it will explore submenu and the part of nav menu that covers the submenu will be hidden.
Here is the screen shot:
Here is the code of head <dropdown> menu if someone finds the problem.
#menu, #menu ul { margin: 0; padding: 0; list-style: none; } #menu { width: 900px; margin-top:20px; margin-left:auto; margin-right:auto; border: 1px solid #222; background-color: #111; background-image: linear-gradient(#444, #111); border-radius: 6px; box-shadow: 0 1px 1px #777; } #menu:before, #menu:after { content: ""; display: table; } #menu:after { clear: both; } #menu { zoom:1; } #menu li { float: left; border-right: 1px solid #222; box-shadow: 1px 0 0 #444; position: relative; } #menu a { float: left; padding: 12px 30px; color: #999; text-transform: uppercase; font: bold 12px Arial, Helvetica; text-decoration: none; text-shadow: 0 1px 0 #000; } #menu li:hover > a { color: #fafafa; } *html #menu li a:hover { /* IE6 only */ color: #fafafa; } #menu ul { margin: 20px 0 0 0; _margin: 0; /*IE6 only*/ opacity: 0; visibility: hidden; position: absolute; top: 38px; left: 0; z-index: 1; background: #444; background: linear-gradient(#444, #111); box-shadow: 0 -1px 0 rgba(255,255,255,.3); border-radius: 3px; transition: all .2s ease-in-out; } #menu li:hover > ul { opacity: 1; visibility: visible; margin: 0; } #menu ul ul { top: 0; left: 150px; margin: 0 0 0 20px; _margin: 0; /*IE6 only*/ box-shadow: -1px 0 0 rgba(255,255,255,.3); } #menu ul li { float: none; display: block; border: 0; _line-height: 0; /*IE6 only*/ box-shadow: 0 1px 0 #111, 0 2px 0 #666; } #menu ul li:last-child { box-shadow: none; } #menu ul a { padding: 10px; width: 130px; _height: 10px; /*IE6 only*/ display: block; white-space: nowrap; float: none; text-transform: none; } #menu ul a:hover { background-color: #0186ba; background-image: linear-gradient(#04acec, #0186ba); } #menu ul li:first-child > a { border-radius: 3px 3px 0 0; } #menu ul li:first-child > a:after { content: ''; position: absolute; left: 40px; top: -6px; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #444; } #menu ul ul li:first-child a:after { left: -6px; top: 50%; margin-top: -6px; border-left: 0; border-bottom: 6px solid transparent; border-top: 6px solid transparent; border-right: 6px solid #3b3b3b; } #menu ul li:first-child a:hover:after { border-bottom-color: #04acec; } #menu ul ul li:first-child a:hover:after { border-right-color: #0299d3; border-bottom-color: transparent; } #menu ul li:last-child > a { border-radius: 0 0 3px 3px; }Here is the code of <nav> menu if someone finds the problem. #cssmenu { width:15%; padding: 0; margin-top: 50px; margin-left:auto; margin right:auto; float:left; border: 0; line-height: 1; } #cssmenu ul, #cssmenu ul li, #cssmenu ul ul { list-style: none; margin: 0; padding: 0; } #cssmenu ul { position: relative; z-index: 597; float: left; } #cssmenu ul li { float: left; min-height: 1px; line-height: 1em; vertical-align: middle; position: relative; } #cssmenu ul li.hover, #cssmenu ul li:hover { position: relative; z-index: 599; cursor: default; } #cssmenu ul ul { visibility: hidden; position: absolute; top: 100%; left: 0px; z-index: 598; width: 100%; } #cssmenu ul ul li { float: none; } #cssmenu ul ul ul { top: -2px; right: 0; } #cssmenu ul li:hover > ul { visibility: visible; } #cssmenu ul ul { top: 1px; left: 99%; } #cssmenu ul li { float: none; } #cssmenu ul ul { margin-top: 1px; } #cssmenu ul ul li { font-weight: normal; } /* Custom CSS Styles */ #cssmenu { width: 200px; background: #333333; font-family: 'Oxygen Mono', Tahoma, Arial, sans-serif; zoom: 1; font-size: 12px; } #cssmenu:before { content: ''; display: block; } #cssmenu:after { content: ''; display: table; clear: both; } #cssmenu a { display: block; padding: 15px 20px; color: #ffffff; text-decoration: none; text-transform: uppercase; } #cssmenu > ul { width: 200px; } #cssmenu ul ul { width: 200px; } #cssmenu > ul > li > a { border-right: 4px solid #1b9bff; color: #ffffff; } #cssmenu > ul > li > a:hover { color: #ffffff; } #cssmenu > ul > li.active a { background: #1b9bff; } #cssmenu > ul > li a:hover, #cssmenu > ul > li:hover a { background: #1b9bff; } #cssmenu li { position: relative; } #cssmenu ul li.has-sub > a:after { content: '+'; position: absolute; top: 50%; right: 15px; margin-top: -6px; } #cssmenu ul ul li.first { -webkit-border-radius: 0 3px 0 0; -moz-border-radius: 0 3px 0 0; border-radius: 0 3px 0 0; } #cssmenu ul ul li.last { -webkit-border-radius: 0 0 3px 0; -moz-border-radius: 0 0 3px 0; border-radius: 0 0 3px 0; border-bottom: 0; } #cssmenu ul ul { -webkit-border-radius: 0 3px 3px 0; -moz-border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0; } #cssmenu ul ul { border: 1px solid #0082e7; } #cssmenu ul ul a { font-size: 12px; color: #ffffff; } #cssmenu ul ul a:hover { color: #ffffff; } #cssmenu ul ul li { border-bottom: 1px solid #0082e7; } #cssmenu ul ul li:hover > a { background: #4eb1ff; color: #ffffff; } #cssmenu.align-right > ul > li > a { border-left: 4px solid #1b9bff; border-right: none; } #cssmenu.align-right { float: right; } #cssmenu.align-right li { text-align: right; } #cssmenu.align-right ul li.has-sub > a:before { content: '+'; position: absolute; top: 50%; left: 15px; margin-top: -6px; } #cssmenu.align-right ul li.has-sub > a:after { content: none; } #cssmenu.align-right ul ul { visibility: hidden; position: absolute; top: 0; left: -100%; z-index: 598; width: 100%; } #cssmenu.align-right ul ul li.first { -webkit-border-radius: 3px 0 0 0; -moz-border-radius: 3px 0 0 0; border-radius: 3px 0 0 0; } #cssmenu.align-right ul ul li.last { -webkit-border-radius: 0 0 0 3px; -moz-border-radius: 0 0 0 3px; border-radius: 0 0 0 3px; } #cssmenu.align-right ul ul { -webkit-border-radius: 3px 0 0 3px; -moz-border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px; } Edited by Dorkmind, 26 November 2014 - 05:00 PM. I decided to redo the individual roster page I have on my site and came up with this. <?php if(isset($_GET['username']) && $_GET['username'] != '') { $username = $_GET['username']; $query = "SELECT bio.username AS username, bio.charactername AS charactername, bio.id AS id, bio.style_id AS style FROM `efed_bio` AS bio ON bio.id = ebw.bio_id WHERE bio.username = '$username'"; if(!$result = mysql_query($query)) while ($row = mysql_fetch_assoc($result)) { $fieldarray=array('id','username','charactername','style'); foreach ($fieldarray as $fieldlabel) { if (isset($row[$fieldlabel])) { $$fieldlabel=$row[$fieldlabel]; $$fieldlabel=cleanquerydata($$fieldlabel); } } } } ?> <h1><?php echo $charactername; ?>'s Biography</h1> <?php echo getBioMenu($style,$username); ?> <? //If the GET page variable is biography, display the biography page if ($page == 'biography') { echo getBiopgrahy($style,$id); } //Or if the GET page variable is gallery, display the gallery page elseif ($page == 'gallery') { echo getGallery($style,$id); } //If the GET page variable is news, display the news page elseif ($page == 'news') { echo getNews($$id); } //If the GET page variable is segments, display the segments page elseif ($page == 'segments') { echo getBioSegments($id,S); } //If the GET page variable is matches, display the matches page elseif ($page == 'matches') { echo getBioSegments($id,M); } elseif ($page == 'chronology') { echo getChronology($id); } //Otherwise display the bio else { echo getBio($style,$id); } ?> The list of characters are listed he http://kansasoutlawwrestling.com/roster An example of someone's individual roster page is located he http://kansasoutlawwrestling.com/bio?username=oriel Hi, I just connect to my server through ftp. i want to edit php.ini file. which is placed in /etc/php.ini "etc" folder. but i'm unable to see etc folder. there are only two folders one is cgi-bin and other is www. can anyone help me to find out etc folder. i've check to show hidden files in filezilla. Thanks I have a really strange query for you all to figure out why I'm not coming up with the right SELECT statement. I've echoed it and I'll show you what I get for a result from the echo as well. Table- Users Fields- id,creator_id,username,password,firstname,lastname,email,status_id,isadmin,datecreated $query = "SELECT CONCAT_WS(' ', firstname, lastname) AS name, CONCAT_WS(' ', firstname, lastname) AS handler, DATE_FORMAT(datecreated, '%M %d, %Y') AS datecreated, id, username, email FROM handlers WHERE handlers.id = handlers.creator_id"; produced this result... SELECT CONCAT_WS(' ', firstname, lastname) AS name, CONCAT_WS(' ', firstname, lastname) AS handler, DATE_FORMAT(datecreated, '%M %d, %Y') AS datecreated, id, username, email FROM handlers WHERE handlers.id = handlers.creator_id php data table code: <?php $query = "SELECT CONCAT_WS(' ', firstname, lastname) AS name, CONCAT_WS(' ', firstname, lastname) AS handler, DATE_FORMAT(datecreated, '%M %d, %Y') AS datecreated, id, username, email FROM handlers WHERE handlers.id = handlers.creator_id"; $result = mysqli_query ( $dbc, $query ); // Run The Query $rows = mysqli_num_rows($result); echo $query; <?php if ($rows > 0) { ?> <table cellspacing="0" class="listTable" id="handlersPageList"> <!-- Thead --> <thead> <tr> <th class="first"><div></div></th> <th><a href="#" title="Handler Name">Handler Name</a></th> <th><a href="#" title="Handler Username">Handler Username</a></th> <th><a href="#" title="Handler Emal">Handler Email</a></th> <th><a href="#" title="Creator">Creator</a></th> <th class="last"><a href="#" title="Date Created">Date Created</a></th> </tr> </thead> while ( $row = mysqli_fetch_array ( $result, MYSQL_ASSOC ) ) { echo ' <tr> <td><input type=checkbox class=checkbox value="' . $row['id'] . '" /></td> <td>' . $row['handler'] . '</td> <td>' . $row['username'] . '</td> <td><a href="mailto:' . $row['email'] . '>' . $row['email'] . '</a></td> <td>' . $row['name'] . '</td> <td class=last>' . $row['datecreated'] . '</td> </tr>'; } ?> I just decided to take out the parts of the page that would be needed to answer this problem instead of the whole file. This is a little confusing okay lets say the first user is the Administrator with an id of 1 obviously has a first name and last name and username and email and the date he registered is his datecreated and his creator_id is going to be preset because he created it himself so its going to be 1. The 1st row in the database displays fine however I have 4 other rows that for some reason aren't displaying. And don't know why. For handlers 2-4 they all have their own first and last names and usernames and everything else however when it comes to the creator_id those 3 have a creator_id of 1 representing that the Administrator created it so in the data table instead of it showing the value of 1 for the creator_id I just want it to get the CONCCAT version of the first and last name of the Administrator. In the past I have not done a very good job of explaining things so I hope this is more than clarified my intention with my code and what it should do and what it is doing wrong right now. If you have any other questions please ask. I am wanting to echo one of these 4 statements depending on the 'status' value. Currently it is showing the status value on the 2nd line but not the statement below.. Code: [Select] <li> <strong>Status: </strong><?php more_fields('status') ?> <?php if (more_fields('status')=="Red") echo "Your account is currently undergoing judgement"; elseif (more_fields('status')=="Green") echo "Your account is currently Live"; elseif (more_fields('status')=="Yellow") echo "Your account is currently undergoing site visits"; elseif (more_fields('status')=="Blue") echo "Your account is currently undergoing insolvency/liquidation";?> </li> any help appreciated. Thanks, Jake Hello all, I am trying to get a simple members.php page to show some HTML but I cannot figure out why it will not display.. Code: [Select] <?php mysql_connect("myserver", "myname", "mypass") or die(mysql_error()); mysql_select_db("mydb") or die(mysql_error()); if(isset($_COOKIE['ID_my_site'])) { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM Users WHERE name = '$name'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($password != $info['password']) { header("Location: login.php"); } else { ?> <html> <body> <h1>WHY</h1> </body> </html> <?php } } } else { header("Location: login.php"); } ?> I was googling and read somewhere that it might be a session bug after the initial '<?php tag'? Any help would be greatly appreciated Tokae Hi People. Here is a form that is supposed to read from my database. My primary key is called "index" and I have about 300 records in the database. I wanted to be able to view the records but when I load this page the "php" part is empty. I simply get given a blank form. I know it is connecting to the DB OK because I changed one letter in the password and then got a "can't connect to the database error" just to test it out. Code: [Select] <?php $host = 'localhost'; $usr = "the_db_user"; $password = 'not_shared_on_forum'; $db_name = 'stranded'; function cr($string){ $clean_string = str_replace("rn","<BR>",$string); return $clean_string; } //$id = 11; if (!isset($id)) $id = $_GET['id']; mysql_connect ("$host","$usr","$password") or die ('Error During Connect:<br>'.mysql_error()); mysql_select_db ("$db_name") or die ('Error Selecting DB:<br>'.mysql_error()); $read_query = "select * from HelperFormData where index = '$id'"; $results = mysql_query($read_query); $rs = mysql_fetch_array($results); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- body,td,th { font-size: 12px; } --> </style></head> <body> Surname: <? echo $rs["surname"]; ?> <table width="500" border="1" bordercolor = "#2c2cf6" textcolor = "#2c2cf6"cellspacing="1" cellpadding="2"> <tr> <td colspan="5">Record number: <? echo $rs["index"]; ?></td> </tr> <tr> <td width="120" bgcolor = #E6F8EB>Surname</td> <td width="120" bgcolor = #E6F8EB>First Name</td> <td width="120" bgcolor = #E6F8EB>phone1</td> <td width="120" bgcolor = #E6F8EB>phone2</td> <td width="120" bgcolor = #E6F8EB>Location</td> </tr> <tr> <td bgcolor = #E6F8EB textcolor = #AC1636><strong><? echo $rs["surname"]; ?></strong></td> <td bgcolor = #E6F8EB><strong><? echo $rs["firstname"]; ?></strong></td> <td bgcolor = #E6F8EB><strong><? echo $rs["phone1"]; ?></strong></td> <td bgcolor = #E6F8EB><strong><? echo $rs["phone2"]; ?></strong></td> <td bgcolor = #E6F8EB><strong><? echo $rs["location"]; ?></strong></td> </tr> <tr> <td bgcolor = #dbeff8>Qualifications</td> <td bgcolor = #dbeff8>Expertise</td> <td bgcolor = #dbeff8>Assistance</td> <td bgcolor = #dbeff8>Languages</td> <td bgcolor = #dbeff8>E-Mail</td> </tr> <tr> <td bgcolor = #dbeff8><strong><? echo $rs["qualifications"]; ?></strong></td> <td bgcolor = #dbeff8><strong><? echo $rs["expertise"]; ?></strong></td> <td bgcolor = #dbeff8><strong><? echo $rs["assistance"]; ?></strong></td> <td bgcolor = #dbeff8><strong><? echo $rs["languages"]; ?></strong></td> <td bgcolor = #dbeff8><strong><? echo $rs["e_mail"]; ?></strong></td> </tr> <tr> <td bgcolor = #E6F8EB>Consent</td> <td bgcolor = #E6F8EB>Published</td> <td bgcolor = #E6F8EB> </td> <td bgcolor = #E6F8EB> </td> <td bgcolor = #E6F8EB> </td> </tr> <tr> <td bgcolor = #E6F8EB><strong><? echo $rs["consent"]; ?></strong></td> <td bgcolor = #E6F8EB><strong><? echo $rs["radio_callsign"]; ?></strong></td> <td bgcolor = #E6F8EB> </td> <td bgcolor = #E6F8EB> </td> <td bgcolor = #E6F8EB> </td> </tr> <tr> <td colspan="5"><p>Comments:<br /> <strong><? echo $rs["comments"]; ?></strong></td> </tr> </table> </body> </html> </html> |