Jump to content

hamza

Members
  • Posts

    321
  • Joined

  • Last visited

Everything posted by hamza

  1. i have a function which is recursively creating list menu i only want to include classes , span tag kindly see the output schema is attached mysql_connect('localhost','root','root');mysql_select_db('sre'); global $menu_array; //running query $result = mysql_query("SELECT * FROM `tblcatagory`"); //fetch rows to show like tree while ( $row = mysql_fetch_assoc($result) ) { $menu_array[$row['cat_id']] = array('Categoryid'=> $row['cat_id'],'name' => $row['cat_name'],'parent' => $row['parent']); } //recursive function that prints categories as a nested html unorderd list function generate_menu($parent) { $has_childs = false; //this prevents printing 'ul' if we don't have subcategories for this category //make array global global $menu_array; //use global array variable instead of a local variable to lower stack memory requierment foreach($menu_array as $key => $value) { if ($value['parent'] == $parent) { //if this is the first child print '<ul>' if ($has_childs === false) { //don't print '<ul>' multiple times $has_childs = true; echo '<ul id="red" class="treevi ew-red treeview">'; } echo '<li> <span> ' . $value['name'].'</span>'; generate_menu($key); //call function again to generate nested list for subcategories belonging to this category echo '</li>'; } } if ($has_childs === true) echo '</ul>';} echo generate_menu(0); i need output like this .......... <UL id="red" class="treeview-red treeview"> <LI><A href="http://www.aeesolar.com/catalog/index.html" id="ovwLink">Overview</A></LI> <LI class="expandable"><DIV class="hitarea expandable-hitarea"></DIV><SPAN>Pre-Configured Systems</SPAN> <UL style="display: none; "> <LI><A href="./AEE Solar grid-tie PV power systems, grid-tie solar power systems_files/AEE Solar grid-tie PV power systems, grid-tie solar power systems.htm" class="selected">Grid-tie</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_PC_GTBB.htm">Grid-tie with battery backup</A></LI> <LI class="last"><A href="http://www.aeesolar.com/catalog/products/H_ASW_PC_RP.htm">Remote power</A></LI> </UL> </LI> <LI class="expandable"><DIV class="hitarea expandable-hitarea"></DIV><SPAN class="">Solar Modules</SPAN> <UL style="display: none; "> <LI class="expandable"><DIV class="hitarea expandable-hitarea "></DIV><SPAN>PV modules</SPAN> <UL style="display: none; "> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_EGS.htm">Evegreen</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_REC.htm">REC</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_MIT.htm">Mitsubishi</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_SWD.htm">SolarWorld</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_SCT.htm">SCHOTT Solar</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_KYO.htm">Kyocera</A></LI> <LI class="last"><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_AEE.htm">AEE Solar</A></LI> </UL> </LI> <LI class="expandable lastExpandable"><DIV class="hitarea expandable-hitarea lastExpandable-hitarea "></DIV><SPAN>Portable PV modules</SPAN> <UL style="display: none; "> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PPVM_GSE.htm">Global Solar</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PPVM_PFM_RU.htm">PowerFilm roll-up</A></LI> <LI class="last"><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PPVM_PFM_UF.htm">PowerFilm ultra-flexible</A></LI> </UL> </LI> </UL> </LI> <LI class="collapsable"><DIV class="hitarea collapsable-hitarea"></DIV><SPAN class="">Mounting Structures</SPAN> <UL style="display: block; "> <LI class="expandable"><DIV class="hitarea expandable-hitarea "></DIV><SPAN>SnapNrack</SPAN> <UL style="display: none; "> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_SNR_UK.htm">Universal kits</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_SNR_SR.htm">Standard rail sets</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_SNR_RA.htm">Roof attachment pieces</A></LI> <LI class="last"><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_SNR_GM.htm">Ground mount</A></LI> </UL> </LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_QMT.htm">Quick Mount PV - waterproof flashing</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_CRT.htm">CreoTecc tile - roof hooks</A></LI> <LI class="expandable"><DIV class="hitarea expandable-hitarea "></DIV><SPAN>Unirac</SPAN> <UL style="display: none; "> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_CMS.htm">CLICKSYS Mounting system</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_2R.htm">2-rail kits</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_4R.htm">4-rail kits</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_RB.htm">Bulk rail bundles</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_LF.htm">L-feet</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_SBP.htm">Splice bars and plates</A></LI> <LI class="expandable"><DIV class="hitarea expandable-hitarea "></DIV><SPAN>Top mounting clamp sets</SPAN> <UL style="display: none; "> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_CS_A.htm">Clear anodized</A></LI> <LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_CS_B.htm">Dark bronze</A></LI> <LI class="last"><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_CS_LFM.htm">Lipped frame model</A></LI> </UL> </LI> [attachment deleted by admin]
  2. hamza

    Query help

    i am selecting user from drop down list and after selecting form submit. and user id submited .on the bases of user_id i need to show user right on all module. how i can do that using one query. my schema ======== CREATE TABLE `tblactions` ( `action_id` int(11) NOT NULL auto_increment, `actions` varchar(255) default NULL, PRIMARY KEY (`action_id`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; CREATE TABLE `tblmoduleactions` ( `moduleaction_id` int(10) NOT NULL auto_increment, `module_id` int(10) default NULL, `action_id` int(10) default NULL, PRIMARY KEY (`moduleaction_id`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; CREATE TABLE `tblmodules` ( `module_id` int(10) NOT NULL auto_increment, `module_name` varchar(255) default NULL, PRIMARY KEY (`module_id`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; CREATE TABLE `tbluserrights` ( `userrights_id` int(10) NOT NULL auto_increment, `user_id` int(10) default NULL, `moduleaction_id` int(10) default NULL, PRIMARY KEY (`userrights_id`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; INSERT INTO `tblactions` VALUES ('1', 'Add'); INSERT INTO `tblactions` VALUES ('2', 'Update'); INSERT INTO `tblactions` VALUES ('3', 'Delete'); INSERT INTO `tblactions` VALUES ('4', 'List'); INSERT INTO `tblmodules` VALUES ('1', 'Manage Category'); INSERT INTO `tblmodules` VALUES ('2', 'Manage Products'); INSERT INTO `tblmodules` VALUES ('3', 'Manage Users'); INSERT INTO `tblmodules` VALUES ('4', 'Manage Manufacture'); INSERT INTO `tbluserrights` VALUES ('1', '11', '1'); INSERT INTO `tbluserrights` VALUES ('2', '12', '2'); INSERT INTO `tblmoduleactions` VALUES ('1', '1', '1'); INSERT INTO `tblmoduleactions` VALUES ('2', '2', '1'); INSERT INTO `tblmoduleactions` VALUES ('3', null, null);
  3. i want to embed flv video <object width="550" height="400"> <param name="movie" value="myvideo.flv"> <embed src="myvideo.flv" width="550" height="400"> </embed> </object>
  4. i want to strip span tag as well as anchor tag this code is in my php post array <br><br><span id="1.612802118875386"><b>Other Page: </b>Matte Card<br><b>Gramage: </b>80 gram<br>sdafsdaf<br> <a href="#" onclick="removetext(1.612802118875386)"> Remove </a> </span><br><br><span id="1.014127052347593"><b>Other Page: </b>Matte Card<br><b>Gramage: </b>100 gram<br>sdfasfsdfdsfsdafsdafas<br> <a href="#" onclick="removetext(1.014127052347593)"> Remove </a> </span> strip tag funtion is not workign for me.
  5. I Want to study zend framework i am not getting on this link http://framework.zend.com/download/latest there are so many for download which one is for beginner and i need exactly dir structur /application /modules # modules directory /default # directory of the module named 'default' /contollers like that kindly guide me about that and give me exact link to direectly download the Zend framework...with guide thanks
  6. $string = array('1_1','1_2','2_3'); $str2arr = explode('_', $string); using this concept how i use explode
  7. 1_1 1_2 3_5 i have this is in $_POST array i want to separate this string by using _ separate. kindly separate the values 1 and 1 from 1_1 or same as like that.others thanks
  8. hamza

    select list

    i wanted to show structur in select option tag. more then 1 level i wnated to show in drop down list . please tell me how it is possible to show. category and subcategory structure ======================== category |_subcat-1 |_subcat-1 |_subcat-1 |_subcat-1 |_subcat-1 Categroy2 |_subcat-1 |_subcat-1 |_subcat-1
  9. thanks for yoru attention i checked the php page without ajax ...... its working then but when i apply ajax then its not working with ajax i menually tries it with yoru suggestion give a dummy name in url but nothing happening........
  10. i have ajax page on which i have created a simple one field form which contain name filed.which is going to insert in database. and query is rouuning on p.php you can see p page below this problem is when form values are not going to p.php page. and i am passed p.php as a parameter in onsubmit even present in form tag. please tell me why this is not running as expected and any better way to improve to write this problem solution thanks p.php <?php echo $action = $_GET['action'] switch ($action) { case 'add': add(); default: } function add() { $link = mysql_connect('locahost','root','root'); mysql_select_db('test'); echo $sql = " INSERT INTO 'user'(name) VALUES('". $_GET['name'] ."') "; mysql_query($sql); echo '1'; } ?> ajax.php <script type="text/javascript"> function loadXMLDoc(url) { req = false; // branch for native XMLHttpRequest object if(window.XMLHttpRequest && !(window.ActiveXObject)) { try { req = new XMLHttpRequest(); } catch(e) { req = false; } // branch for IE/Windows ActiveX version } else if(window.ActiveXObject) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { req = false; } } } if(req) { alert(url); req.onreadystatechange = processReqChange; req.open("GET", url, true); req.send(""); } } function processReqChange() { // only if req shows "loaded" if (req.readyState == 4) { // only if "OK" if (req.status == 200) { div_msg.innerHtml = req.responcetext; // ...processing statements go here... } else { alert("There was a problem retrieving the XML data:\n" + req.statusText); } } } </script> <div id="div_msg"></div> <form method="GET" onsubmit="loadXMLDoc('p.php')"> <input type="text" name="name"> <input type="hidden" name="action" value="add"> <input type="submit"> </form>
  11. yeah desc is a reserv word try to change it ...descr or description.
  12. There is no such extension. i wanted to know about crystal reports
  13. -- ---------------------------- -- Table structure for articals -- ---------------------------- CREATE TABLE `articals` ( `artical_id` int(11) NOT NULL auto_increment, `cat_id` int(11) default NULL, `title` varchar(255) default NULL, `dateandtime` datetime default NULL, `img` varchar(255) default NULL, `description` text, `tags` varchar(255) default NULL, PRIMARY KEY (`artical_id`) ) ENGINE=MyISAM AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; catagory table - ---------------------------- -- Table structure for categories -- ---------------------------- CREATE TABLE `categories` ( `cat_id` int(11) NOT NULL auto_increment, `cat_name` varchar(255) default NULL, PRIMARY KEY (`cat_id`) ) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; problem : when i del catagory from catagory table then evey artical have catagory field. but if i del a catagory which is present in artical table then. it soud ugly or what should i do del the artical when del the catagory. kindly guide me and see the data schema.
  14. dumping code is not good idea. show what you are getting in error...
  15. what is Crystal reports in php? why how we can use them??
  16. no no now its working fine there is a syntax error there now solved but one thing you are missing in there n that is case sensitive. i am getting two php tags liek PHP and php. now i think while insertion i should make it strtolower.
  17. any alternative way to fetch tags from database with unique list. this code is not working.
  18. i have tags field in my table and tags field is optional when tags are addes so most of the time tag field is empty with no tag. and some time there are so many tags in a tag field of database. like in my artical table i have tags field which contain php, frameworks , advance php empty field java jquery how i can fetch all tags to show on user side and ignore empty field. and should be unique tags in the list. my fetch funtion is show as /** getting all tags */ function get_all_tags($db) { //cat array contain catagory names and id $tag = array(); //getting all catagories from database. $result = $db->query("SELECT tags FROM `articals`", $debug = -1); while($row = $db->fetchNextObject($result)) { if ( !empty($row->tags) ) { explode(',',$row->tags); $tag[] = $row->tags; } } //making unique array of print '<pre>'; print_r($tag); $tag = array_unique($tag); print_r($tag); return $tag; }
  19. i-frames are not very friend when we talk about browsers. so i suggest use ajax
  20. make something like that $fletch = date ("Ymd",time()); or if u r fetching from database then fetching field be something lke that $db_firld = strtotime('your db field'); $fletch = date ("Ymd",$db_firld);
  21. by default allowing is enable or not for .htaccess file. can we enable it in php.ini or if i have many .htaccess files then evy time i have to allow it by using tags u shown above.
×
×
  • 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.