| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 42018 | 2004-01-29 09:26:00 | PhP Code | SanSingh (4824) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 210997 | 2004-01-29 09:26:00 | I have website done in PhP/Mysql. I would like to create a submenu for the product, example CPU...Sub will Intel, AMD. I need code or suggestion how to do this.. I am just learning PHP | SanSingh (4824) | ||
| 210998 | 2004-01-29 10:27:00 | This is done in frames and two tables in mySQL called m_category and m_subcat . In the topFrame is a title page with: <?php /* start of menu main categories */ /* extract the main category information */ $query=( " SELECT * FROM m_category ORDER BY listorder ASC " ); $result = mysql_query($query) or die( " Error in current query: $query . " . mysql_error()); /* Open the category while statement */ while($row = mysql_fetch_array($result)) { $catid = $row[0]; $category = $row[1]; echo " <a href=\ " pages . php?catid=$catid\ " target=\ " mainFrame\ " >$category</a>\n " ; } /* end of menu main categories */ ?> In the mainFrame is a page called pages . php: <?php /* navigation sub-menu */ /* main category */ /* extract the main category information */ $query=( " SELECT category FROM m_category WHERE catid='$catid' " ); $result = mysql_query($query) or die( " Error in query1: $query . " . mysql_error()); if(mysql_num_rows($result=mysql_query($query))) { /* Open the category while statement */ while($row = mysql_fetch_array($result)) { /* Print the main category */ $category = $row[0]; echo " $category " ; echo " " ; /* sub categories */ /* extract subcategory information */ $subquery = ( " SELECT * FROM m_subcat WHERE catlink = '$catid' AND active = '0' " ); $subres = mysql_query($subquery) or die( " Error in query2: $subquery . " . mysql_error()); /* loop through result rows */ while ($row = mysql_fetch_array($subres)) { /* Print the subcat details */ $subcatid = $row[0]; $subcat = $row[2]; echo " <a href=\ " . . /entry/pages . php?catid=$catid&subcat_id=$subcatid\ " target=\ " mainFrame\ " >$subcat</a> " ; /* close the subcat while statement */ } /* close the main category while statement */ } /* Place line breaks to pad out the end */ echo " " ; } else { echo " " ; } ?> The table fields can be worked out from the array declarations . |
Merlin (503) | ||
| 210999 | 2004-01-30 10:29:00 | Thank you very much, could you please post a sample site that has submenu | SanSingh (4824) | ||
| 211000 | 2004-01-30 10:53:00 | I have found what I need (http://www.tdata.co.nz/) I hope your code is for that type of sub catergory My website product catergory is on the left hand site, I need sub_catergory similar to site above. |
SanSingh (4824) | ||
| 211001 | 2004-01-31 00:39:00 | The "tdata" menus were done with "coolmenus" dhtml code. This is free from here:- www.dhtmlcentral.com | linw (53) | ||
| 211002 | 2004-01-31 06:29:00 | thank for the sub menu site | SanSingh (4824) | ||
| 211003 | 2004-02-04 11:03:00 | Mike thanks you once again, It submenu code worked OK. some error looks to me need more time to configure properly. I would to create CSV file , any idea how to do this | SanSingh (4824) | ||
| 211004 | 2004-02-04 11:05:00 | Thanks to Merlin not mike | SanSingh (4824) | ||
| 1 | |||||