drisate
Members-
Posts
805 -
Joined
-
Last visited
Everything posted by drisate
-
Array ( [42] => Array ( [titre1] => Gestions des pages [parent] => 11 [idd] => 42 [add] => 0 [mod] => 0 [del] => 0 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [11] => Array ( [titre1] => Zone de gestion [parent] => 0 [idd] => 11 [add] => 3 [mod] => 0 [del] => 0 [adds] => 0 [mods] => 3 [dels] => 3 [dtype] => 14 ) [14] => Array ( [titre1] => HÉBERGEMENT [parent] => 0 [idd] => 14 [add] => 0 [mod] => 3 [del] => 0 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 15 ) [34] => Array ( [titre1] => François Blaquière [parent] => 17 [idd] => 34 [add] => 0 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [35] => Array ( [titre1] => Joëlle Bergeron [parent] => 17 [idd] => 35 [add] => 0 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [36] => Array ( [titre1] => Patrick Simard [parent] => 17 [idd] => 36 [add] => 0 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [37] => Array ( [titre1] => Florian Siretas [parent] => 17 [idd] => 37 [add] => 0 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [38] => Array ( [titre1] => Valeria Valdes [parent] => 17 [idd] => 38 [add] => 0 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [39] => Array ( [titre1] => Marie-Ève Matte [parent] => 17 [idd] => 39 [add] => 0 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [15] => Array ( [titre1] => Sauvegarde [parent] => 0 [idd] => 15 [add] => 0 [mod] => 3 [del] => 0 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [16] => Array ( [titre1] => Entreprise [parent] => 0 [idd] => 16 [add] => 0 [mod] => 3 [del] => 0 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [17] => Array ( [titre1] => Équipe [parent] => 0 [idd] => 17 [add] => 3 [mod] => 0 [del] => 0 [adds] => 0 [mods] => 3 [dels] => 3 [dtype] => 14 ) [18] => Array ( [titre1] => Services [parent] => 0 [idd] => 18 [add] => 0 [mod] => 0 [del] => 0 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [19] => Array ( [titre1] => Centre de données [parent] => 0 [idd] => 19 [add] => 0 [mod] => 0 [del] => 0 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [20] => Array ( [titre1] => Aide aux utilisateurs [parent] => 0 [idd] => 20 [add] => 3 [mod] => 3 [del] => 0 [adds] => 3 [mods] => 3 [dels] => 3 [dtype] => 17 ) [21] => Array ( [titre1] => La configuration de votre courriel. [parent] => 20 [idd] => 21 [add] => 3 [mod] => 3 [del] => 0 [adds] => 3 [mods] => 3 [dels] => 3 [dtype] => 18 ) [23] => Array ( [titre1] => Configuration de Outlook Express [parent] => 23 [idd] => 23 [add] => 0 [mod] => 0 [del] => 0 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 0 ) [24] => Array ( [titre1] => Configuration de Outlook 2003 [parent] => 21 [idd] => 24 [add] => 3 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [25] => Array ( [titre1] => Configuration de Outlook 2007 [parent] => 21 [idd] => 25 [add] => 3 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [40] => Array ( [titre1] => Site Internet [parent] => 26 [idd] => 40 [add] => 0 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [26] => Array ( [titre1] => Accueil [parent] => 0 [idd] => 26 [add] => 3 [mod] => 3 [del] => 0 [adds] => 0 [mods] => 3 [dels] => 3 [dtype] => 12 ) [43] => Array ( [titre1] => Infolettre [parent] => 11 [idd] => 43 [add] => 0 [mod] => 0 [del] => 0 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [45] => Array ( [titre1] => Site Internet [parent] => 26 [idd] => 45 [add] => 0 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [46] => Array ( [titre1] => Site Internet [parent] => 26 [idd] => 46 [add] => 0 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [47] => Array ( [titre1] => Site Internet [parent] => 26 [idd] => 47 [add] => 0 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 0 ) [48] => Array ( [titre1] => Site Internet [parent] => 26 [idd] => 48 [add] => 0 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 0 ) [50] => Array ( [titre1] => Téléchargement [parent] => 0 [idd] => 50 [add] => 3 [mod] => 0 [del] => 0 [adds] => 0 [mods] => 3 [dels] => 3 [dtype] => 19 ) [51] => Array ( [titre1] => Skype [parent] => 50 [idd] => 51 [add] => 0 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 11 ) [52] => Array ( [titre1] => TeamViewer [parent] => 50 [idd] => 52 [add] => 0 [mod] => 3 [del] => 3 [adds] => 0 [mods] => 0 [dels] => 0 [dtype] => 0 ) I have an array that looks like this. I need to count how much data there is in each parent. Ex: id 1 has parent 0 id 2 has parent 1 id 3 has parent 1 so the code must return 2 for id 1, 0 for id 2 and 0 for id 3 How the hell do i do that lol
-
Well the table is made like this id, name , parent ________________ 1, blablabla, 0 2, blablabla, 0 3, blablabla, 2 4, blablabla, 2 5, blablabla, 4 So the menu output should be 1 blablabla (Level 0) 2 blablabla (Level 0) 3. blablabla (Level 1) 4. blablabla (Level 1) 5. blablabla (Level 2) I need to know what the level of item 5 is check_level('5', $level) Should return 2 I tryed you code above but it's a never ending loop. This is what the script should do 1. Check the parent number of 5. 2. Parent number is 4 3. Increment level 0 to 1 4. Check parent number of 4 5. Parent number is 2 6. Increment level 1 to 2 7. Check parent number of 2 8. Parent number is 0 9. Return increment level 2
-
function check_level($id, $level){ $check = @current(@mysql_fetch_assoc(@mysql_query("SELECT parent FROM page_categ WHERE id = '$id'"))); $level++; if ($check != "0") { check_level($check, $level); } else { return $level; } } I am trying to check the level of a menu item 1 blablabla (Level 0) 2 blablabla (Level 0) 3. blablabla (Level 1) 4. blablabla (Level 1) 5. blablabla (Level 2) The last item (5) should return level 2 The function above is not recalling it self. It's only detecting the first level
-
Thx this is what i did for future ref $list3 = implode("-" , array_unique(explode("-",$bouton[bouton]))); $ex = explode ('-', $list3); foreach($ex as $value){ if ($value){ $string .= "-$value-"; } }
-
Hey guys i have a string that looks like this -3--3--3--3--3--3--3--3--3--3--10--10--10--10--10--10--10--10--10--10--7--7--7--7--7--7--7--7--7--7--12--12--12--12--12--12--12--12--12--12--1--1--1--1--1--1--1--1--1--1--19--19- How can i remove the duplicates so it looks like -3--10--7--12--1--19- It needs to be fast because there will be a lot of strings to be checked
-
Hey guys i am creating a Greasemonkey script that adds an ajax chat to a website. Greasemonkey is an addon for firefox that lets you modify the html code of websites before they are showed to the user. I am in the process of creating a wizz feature that will allow you to send a message to a member and where ever he is on the web his gona receive it. The way it works right now is there's a hidden iframe in every page load and when the player has a message it popups a small window It's working great but the popup is always instantly blocked because firefox has a popup bloker integrated and because it can popup on random websites they don't allow it and there for never gets the message ... Everything else i tryed was blocked by the fact that it opens in the iframe that is invisible I even tryed doing it the old fashon way with an alert() but same thing you don't see it because it's in the hidden frame I am out of ideas ...
-
I tryed it and i get Warning: Invalid argument supplied for foreach() in /var/www/vhosts/dramis.info/httpdocs/index.php on line 160 I think you code is breaking the array $select = mysql_query("SELECT usergroupid, userid FROM vb_user AS u CROSS JOIN vb_post AS p USING(userid) WHERE dateline > UNIX_TIMESTAMP(CURDATE() - INTERVAL 30 DAY) AND u.usergroupid = 22") or die(mysql_error()); while ($list = mysql_fetch_array($select)) { $store[$list['usergroupid']][$list['userid']] += 1; } arsort($store[22]); $store=array_reverse($store[22]); foreach($store as $k => $v) { foreach($v as $kk => $vv) { unset($wuser); $wuser = @mysql_fetch_array(@mysql_query("SELECT * FROM vb_user WHERE userid='$kk'")); print ('<tr vAlign="top"><td class="thead" align="left" width="20%"><a href="board/member.php?u='.$wuser[userid].'"><font color="#FFFFFF">'.$wuser[username].'</font></a></td><td class="thead" align="left" width="80%"><font color="#FFFFFF">'.$vv.'</font></td></tr>'); } }
-
I have an array that looks like this Array ( [22] => Array ( [113] => 6 [154] => 1 [166] => 4 ) ) How can i sort the 6, 1, 4 to look like this? Array ( [22] => Array ( [113] => 6 [166] => 4 [154] => 1 ) )
-
Oh got it i had to remove the GROUP BY u.usergroupid part THX YOU SO MUCH !!
-
thanks for the help :-) I tryed your code and i get the same result + the number of posted message is wroung $select = mysql_query("SELECT usergroupid, userid FROM vb_user AS u CROSS JOIN vb_post AS p USING(userid) WHERE dateline > UNIX_TIMESTAMP(CURDATE() - INTERVAL 30 DAY) AND u.usergroupid = 22 GROUP BY u.usergroupid") or die(mysql_error()); while ($list = mysql_fetch_array($select)) { $store[$list['usergroupid']][$list['userid']] += 1; } foreach($store as $k => $v) { foreach($v as $kk => $vv) { unset($wuser); $wuser = @mysql_fetch_array(@mysql_query("SELECT * FROM vb_user WHERE userid='$kk'")); print ('<tr vAlign="top"><td class="thead" align="left" width="20%"><a href="board/member.php?u='.$wuser[userid].'"><font color="#FFFFFF">'.$wuser[username].'</font></a></td><td class="thead" align="left" width="80%"><font color="#FFFFFF">'.$vv.'</font></td></tr>'); } } print ('<tr><td colspan"2"><pre>'); print_r($store); print ('</pre></td></tr>'); I get: only one result out of 3 and the message count is set to one: Array ( [22] => Array ( [113] => 1 ) ) It's weird ...
-
More i look at it and more i thing the message_Count is equal to the total messages posted by that groupe in the last 30 days instead of being the number for that user ... could that even be the problem? Is the SQL builded to return the users, nb of post? I need this to return a list BLABLABLA posted X messages BLABAL posted X messages BLABALAB posted x messages
-
Yup for somereason it only returns the first row i made a print_r and this is what i got Array ( [0] => 22 [usergroupid] => 22 [1] => 113 [userid] => 113 [2] => 11 [message_Count] => 11 ) I know for sure it should return at least 3 rows
-
I tryed this but it only returns the first. $select = mysql_query("SELECT usergroupid, userid, COUNT(*) AS message_Count FROM vb_user AS u CROSS JOIN vb_post AS p USING(userid) WHERE dateline > UNIX_TIMESTAMP(CURDATE() - INTERVAL 30 DAY) AND u.usergroupid = 22 GROUP BY u.usergroupid") or die(mysql_error()); while ($list = mysql_fetch_array($select)) { echo "$list[userid]<br>"; }
-
Hey guys i need to make a script that counts the number of message posted in the last 30 days for a certain groupe in a board. This is how the user table is created userid, usergroupid, username This is how the post table looks like postid, threadid, username, userid, dateline The dateline data looks like this: 1257473259 I need to loop the user table then count how much message the users from usergroupid 2 posted in the past 30 days.
-
Hey guys! I need to check if a columns exist before permorming a table alteration, This is what i got so fare: IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = `page` AND COLUMN_NAME = `aaa` ) BEGIN ALTER TABLE `page` ADD `aaa` LONGTEXT NOT NULL END The MySQL error it returns is: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = `pag' at line 1
-
Ok i got it hehe how do i modify this regular expression /^([a-z -]+)(\d+)(?:[ ]+([a-z -]+)(\d+))?/im To make it pick up ? Metal: 171.028 Crystal: 83.759 Deuterium: 222.907 Energy: 4.275 The number may or may not contain a dot
-
I think that preg_match is matching something else ... i tryed this : if (!$rexex1){ if (preg_match('/([a-z -]+)(\d+)(?:[ ]+([a-z -]+)(\d+))?/im', $str[$i], $regs1)) { $Weapon1 = $regs1[1]; $Power1 = $regs1[2]; $Weapon2 = $regs1[3]; $Power2 = $regs1[4]; $rexex1 = "used"; } } Just to make sure the preg_match is used just one time and it returned: Weapon1 = on Power1 = 02 Weapon2 = Power2 =
-
Ok thx. I did this: if (preg_match('/([a-z -]+)(\d+)(?:[ ]+([a-z -]+)(\d+))?/im', $str[$i], $regs1)) { $Weapon1 = $regs1[1]; $Power1 = $regs1[2]; $Weapon2 = $regs1[3]; $Power2 = $regs1[4]; } if (preg_match('/^Chance of counter.*?:\s+(\d+)\s+%\s+$/im', $str[$i], $regs2)){ $counter= $regs2[1]; } And now i get Weapon1 = Power1 = 15 Weapon2 = Power2 = counter = 15
-
Nope ... this si what i have so fare. You code returns nothing <?php // first we check if the form has been posted if ($_POST[str]){ echo "------- DEBUG Output ---------<br><br>"; // We explode each lines $str = explode("\r\n",$_POST["str"]); $linecount = count($str); // Number of lines // We loop the lines $i=0; while($i<=$linecount){ // We filter out empty lines $line = str_replace (' ', '', $str[$i]); if ($line!=""){ preg_match('/^([a-z -]+)(\d+)(?:[ ]+([a-z -]+)(\d+))?$/im', $str[$i], $regs); $Weapon1 = $regs[1]; $Power1 = $regs[2]; $Weapon2 = $regs[3]; $Power2 = $regs[4]; // Line is not empty echo "Line: $i) ".$str[$i]."<br>"; } $i++; } echo "<br><br>Weapon1 = $Weapon1<br>Power1 = $Power1<br>Weapon2 = $Weapon2<br>Power2 = $Power2<br>"; echo "<br>------- DEBUG Output ---------"; }else{ print ('<form action="index.php?mod=esp" method="POST"> <p><textarea rows="16" name="str" cols="59"></textarea></p><p><input type="submit" value="Submit" name="B1"></p> </form>'); } ?> The above returns: ------- DEBUG Output --------- Line: 0) Resources at Blant Topia [2:464:4] (Player 'nemrack') on 02-08 05:09:39 Line: 1) Metal: 171.028 Crystal: 83.759 Line: 2) Deuterium: 222.907 Energy: 4.275 Line: 4) Activity Line: 5) Activity Line: 6) Activity means that the scanned player has been active on that planet or another player had fleet contact with the planet you scanned. Line: 7) Your espionage does not show abnormalities in the atmosphere of the planet. There appears to have been no activity on the planet within the last hour. Line: fleets Line: 9) Small Cargo 5 Light Fighter 556 Line: 10) Cruiser 3 Colony Ship 1 Line: 11) Espionage Probe 10 Solar Satellite 50 Line: 12) Defense Line: 13) Rocket Launcher 600 Light Laser 100 Line: 14) Heavy Laser 5 Gauss Cannon 3 Line: 15) Ion Cannon 30 Small Shield Dome 1 Line: 16) Anti-Ballistic Missiles 1 Line: 17) Chance of counter-espionage: 15 % Line: 18) Attack Weapon1 = Power1 = Weapon2 = Power2 = ------- DEBUG Output ---------
-
Hey guys i need help extracting into usable vars each read part of the folowing texte. Resources at Blant Topia [2:464:4] (Player 'nemrack') on 02-08 05:09:39 Metal: 171.028 Crystal: 83.759 Deuterium: 222.907 Energy: 4.275 Activity Activity Activity means that the scanned player has been active on that planet or another player had fleet contact with the planet you scanned. Your espionage does not show abnormalities in the atmosphere of the planet. There appears to have been no activity on the planet within the last hour. fleets Small Cargo 5 Light Fighter 556 Cruiser 3 Colony Ship 1 Espionage Probe 10 Solar Satellite 50 Defense Rocket Launcher 600 Light Laser 100 Heavy Laser 5 Gauss Cannon 3 Ion Cannon 30 Small Shield Dome 1 Anti-Ballistic Missiles 1 Chance of counter-espionage: 15 % Attack The idea is creating a small texte box where the player will copy in the texte above after what it will be changed into a Board freindly bbcode format. I made a loop that explode the line like this ------- DEBUG Output --------- Line: 0) Resources at Blant Topia [2:464:4] (Player 'nemrack') on 02-08 05:09:39 Line: 1) Metal: 171.028 Crystal: 83.759 Line: 2) Deuterium: 222.907 Energy: 4.275 Line: 4) Activity Line: 5) Activity Line: 6) Activity means that the scanned player has been active on that planet or another player had fleet contact with the planet you scanned. Line: 7) Your espionage does not show abnormalities in the atmosphere of the planet. There appears to have been no activity on the planet within the last hour. Line: fleets Line: 9) Small Cargo 5 Light Fighter 556 Line: 10) Cruiser 3 Colony Ship 1 Line: 11) Espionage Probe 10 Solar Satellite 50 Line: 12) Defense Line: 13) Rocket Launcher 600 Light Laser 100 Line: 14) Heavy Laser 5 Gauss Cannon 3 Line: 15) Ion Cannon 30 Small Shield Dome 1 Line: 16) Anti-Ballistic Missiles 1 Line: 17) Chance of counter-espionage: 15 % Line: 18) Attack ------- DEBUG Output ---------
-
Got it ... it needed a return ... function filigrame($categ, $nom){ unset($filigrame); $sql = "SELECT * FROM page_categ WHERE id = '$categ'"; $filigrame = @mysql_fetch_assoc(@mysql_query("$sql")); $nom = $nom." -> $filigrame[nom]"; if ($filigrame[top_id]!="0"){ return filigrame($filigrame[top_id], $nom); }else{ return "Accueil ".$nom; } }
-
No errors function filigrame($categ, $nom){ $sql = "SELECT * FROM page_categ WHERE id = '$categ'"; $result = mysql_query($sql) or trigger_error("SQL: $sql, ERROR: " . mysql_error(), E_USER_ERROR); $filigrame = mysql_fetch_assoc($result); $nom = $nom." -> $filigrame[nom]"; if ($filigrame[top_id]!="0"){ filigrame($filigrame[top_id], $nom); }else{ return "Accueil ".$nom; } } This is my table CREATE TABLE `page_categ` ( `id` int(9) NOT NULL auto_increment, `nom` varchar(250) NOT NULL, `type` int(9) NOT NULL, `nom_en` varchar(250) NOT NULL, `top_id` int(9) NOT NULL, `ordre` int(10) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=150 DEFAULT CHARSET=utf8 AUTO_INCREMENT=150 ; -- -- Contenu de la table `page_categ` -- INSERT INTO `page_categ` (`id`, `nom`, `type`, `nom_en`, `top_id`, `ordre`) VALUES (97, 'Répertoire des commerces', 6, '', 0, 0), (81, 'Vêtements hommes', 4, '', 79, 0), (80, 'Vêtements femmes', 4, '', 79, 0), (98, 'Carte de l'artère', 2, '', 97, 0), (79, 'Ma plaza mode', 2, '', 78, 0), (78, 'Ma plaza', 6, '', 0, 0), (99, 'Liste par addresse', 2, '', 97, 0), (82, 'Chaussures', 4, '', 79, 0), (83, 'Accessoires, lingerie & maillots', 4, '', 79, 0), (84, 'Ma plaza gourmande', 2, '', 78, 0), (85, 'Alimantation spécialisée', 4, '', 84, 0), (86, 'Restaurant', 4, '', 84, 0), (87, 'Ma plaza divertissante', 3, '', 78, 0), (89, 'Ma plaza mariage ', 2, '', 78, 0), (90, 'Nouvelles', 4, '', 89, 0), (91, 'Répertoire', 4, '', 89, 0), (92, 'Portraits', 4, '', 89, 0), (93, 'Promotion', 4, '', 89, 0), (94, 'Témoignages', 4, '', 89, 0), (95, 'Ma plaza, mes services', 2, '', 78, 0), (96, 'Ma plaza kitch', 3, '', 78, 0), (100, 'Liste par catégorie', 2, '', 97, 0), (101, 'Liste par ordre alphabétique', 2, '', 97, 0), (102, 'Actualités', 6, '', 0, 0), (103, 'Nouvelles', 4, '', 102, 0), (104, 'Évènement', 4, '', 102, 0), (105, 'Nouveaux commerces', 4, '', 102, 0), (106, 'Promotions', 4, '', 102, 0), (107, 'Photos', 4, '', 102, 0), (108, 'Emplois', 4, '', 102, 0), (109, 'À propos de la plaza', 6, '', 0, 0), (110, 'Historique', 2, '', 109, 0), (112, '59 à 79', 3, '', 110, 0), (113, '59 à 89', 3, '', 110, 0), (114, '59 à 2009', 3, '', 110, 0), (115, 'Accessibilité', 3, '', 109, 0), (116, 'Stationnements', 3, '', 109, 0), (117, 'Heures d'ouvertures', 3, '', 109, 0), (118, 'FAQ', 4, '', 109, 0), (119, 'Médias', 3, '', 109, 0), (120, 'Photos et vidéos', 2, '', 109, 0), (121, 'Photos', 4, '', 120, 0), (122, 'Vidéos', 4, '', 120, 0), (123, 'La SDC', 6, '', 0, 0), (124, 'Mission', 3, '', 123, 0), (125, 'Conseil d'aministration', 3, '', 123, 0), (126, 'Équipe', 3, '', 123, 0), (127, 'Partenaires', 3, '', 123, 0), (128, 'Contact', 3, '', 123, 0), (129, 'Annoncer ici', 3, '', 0, 0), (130, 'Membres SDC', 6, '', 0, 0), (131, 'Services', 3, '', 130, 0), (132, 'Nouveautés', 4, '', 130, 0), (133, 'Locaux à louer', 4, '', 130, 0), (134, 'PR@M', 3, '', 130, 0), (135, 'Intranet', 2, '', 130, 0), (136, 'Modifier votre profile', 3, '', 135, 0), (137, 'Communiqués', 3, '', 135, 0), (138, 'Règlements', 3, '', 135, 0), (139, 'Assemblées générales', 3, '', 135, 0), (140, 'Dates importantes', 3, '', 135, 0), (141, 'Info - Plaza', 3, '', 135, 0), (142, 'FAQ - Membres', 3, '', 135, 0), (143, 'Liens utiles', 3, '', 135, 0), (144, 'Photos et vidéos', 2, '', 130, 0), (145, 'Photos', 4, '', 144, 0), (146, 'Vidéos', 4, '', 144, 0), (147, 'Contact', 0, '', 0, 0), (148, 'Accueil', 1, '', 0, 0), (149, 'Cyberbuletin', 0, '', 0, 1); As you can see, Restaurant is id 86 and that category is in top_id 84. 84 is Ma plaza gourmande and thats in top_id 78. 78 is Ma plaza and has 0 as top_id so that would be the top of the categories. That should show Ma plaza -> Ma plaza gourmande -> Restaurant But it's not returning anything my php code to call the function looks like this: //[...] $mysql = "(page.titre like '%$recherche%' or page.texte1 like '%$recherche%' or page.texte2 like '%$recherche%' or page.texte3 like '%$recherche%' or page.description_photo like '%$recherche%' or page.entreprise like '%$recherche%' or page.adresse like '%$recherche%') and page.categ=page_categ.id"; //and page_categ.id=page.categ and page_categ.type!='5' //[...] $mselect = mysql_query("SELECT * FROM page, page_categ where $mysql limit $offset, $nombre_par_page") or die(mysql_error()); while ($list = mysql_fetch_array($mselect)) { //[...] echo filigrame($list[categ], ""); //[...] } //[...]
-
hey guys i have an unlimited category systeme and i need to print out the path of a specifique id ... Ex: Canada -> Montreal -> Comercial -> Shop -> T-Shirts The SQL has a normal unlimited category structure with a top_id to know the parent category. id, nom, type, nom_en, top_id, ordre My code so fare looks like this function filigrame($categ, $nom){ $filigrame = @mysql_fetch_assoc(@mysql_query("SELECT * FROM page_categ WHERE id = '$categ'")); $nom = $nom." -> $filigrame[nom]"; if ($filigrame[top_id]!="0"){ filigrame($filigrame[top_id], $nom); }else{ return "Accueil ".$nom; } } Right now it only print out categories that has no parent id (top_id=0). Looks like for some reason it's not relooping at the if $filigrame[top_id]!="0" part ... Any help would be very appreciated. Thx in advance.
-
Hey guys. I am creating a 10 level deep categorie systeme but i am completly lost in my logic and can't seem to figure this out... I have a table that looks like this: CREATE TABLE `page_categ_ass` ( `id` int(9) NOT NULL auto_increment, `s_categ_1` int(9) NOT NULL, `s_categ_2` int(9) NOT NULL, `s_categ_3` int(9) NOT NULL, `s_categ_4` int(9) NOT NULL, `s_categ_5` int(9) NOT NULL, `s_categ_6` int(9) NOT NULL, `s_categ_7` int(9) NOT NULL, `s_categ_8` int(9) NOT NULL, `s_categ_9` int(9) NOT NULL, `s_categ_10` int(9) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; And an other one like this: CREATE TABLE `page_categ` ( `id` int(9) NOT NULL auto_increment, `nom` varchar(250) NOT NULL, `type` int(9) NOT NULL, `place` int(1) NOT NULL, `ordre` int(9) NOT NULL, `cronique` int(9) NOT NULL, `mcat` varchar(9) NOT NULL, `nom_en` varchar(250) NOT NULL, `s_categ` int(9) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; What i am trying to do is create a catégorie in page_categ then associate it with the page_categ_ass table using the id of the association as the s_categ of page_categ. To do that i need to create a menu box with all the categories in order. I am trying to do something that looks like this: Name -Sub 1 -Sub 1 --Sub 2 ---Sub 3 ---Sub 3 ----Sub 4 -----Sub 5 ------Sub 6 ------Sub 6 ------Sub 6 ------Sub 6 -------Sub 7 [Ext] But i can't seem to figure out how ... This is the code i have so fare function arbre($col, $loop, $current, $now){ if ($loop==""){$loop="1";} if ($now==""){$now = @current(@mysql_fetch_assoc(@mysql_query("SELECT s_categ_1 FROM page_categ_ass order by id asc limit 1")));} $select = mysql_query("SELECT * FROM page_categ_ass where $col='$now' order by id asc") or die(mysql_error()); while ($page_ass = mysql_fetch_array($select)) { $i = 1; while($i < 10) { $espace .= "-"; $i++; } $b = 1; while($b < $loop) { $value .= $page_ass['s_categ_'.$loop]."-"; $b++; } $value = substr($value, 0, -1); echo '<option value="'.$value.'" '; if ($page_ass['s_categ_'.$loop]==$current){echo "SELECTED";} echo '>'.$espace.'</option>'; } $loop++; if ($loop<="10"){ arbre("s_categ_$loop", $loop, $current, $now); } } I am lost ... I have no idea how to do this. Any help would be appreciated.