Dippy Posted August 20, 2013 Report Share Posted August 20, 2013 Hello I have a room list by php and now I like to make the roomlist in category order and room order such as offical room and such to do this I'm guessing it has to be done by mysql how do I go about doing this ? how do I make the mysql get the rooms and update? Many thanks for replys Link to comment Share on other sites More sharing options...
err0r Posted August 20, 2013 Report Share Posted August 20, 2013 it depends, mysql would be the storage system. are you able to store the rooms in mysql.. are you still required to join the server using php to get the roomlist? How are the rooms separated into categories. Would need more info. Link to comment Share on other sites More sharing options...
Dippy Posted August 20, 2013 Author Report Share Posted August 20, 2013 At the moment I just got the basic that you did for me a while back with a little edit to it there no category on it yet and no I not got rooms stored on the mysql yet as I'm not sure how it done Many thanks for reply Link to comment Share on other sites More sharing options...
err0r Posted August 20, 2013 Report Share Posted August 20, 2013 i would prolly set up a cron job to put the rooms and info in the mysql db every 3-5 minutes.. then just query the table ordering however you wish. Or you can just put the info into a php array then sort by what you want. Link to comment Share on other sites More sharing options...
Dippy Posted August 20, 2013 Author Report Share Posted August 20, 2013 ok I knocked this up but unsure how to get the rooms to the mysql <? $cat = $_GET['cat']; if ($cat == "") { include_once('pages/list-blank.php'); return; } if ($cat == "CC") { $category = "City Chats"; } else if ($cat == "CP") { $category = "Computing"; } else if ($cat == "EA") { $category = "Entertainment"; } else if ($cat == "GN") { $category = "General"; } else if ($cat == "LS") { $category = "Lifestyles"; } else if ($cat == "SP") { $category = "Spirituality"; } else if ($cat == "NW") { $category = "News"; } else if ($cat == "PR") { $category = "Peers"; } else if ($cat == "RL") { $category = "Religion"; } else if ($cat == "RP") { $category = "Roleplay"; } else if ($cat == "RM") { $category = "Romance"; } else if ($cat == "TN") { $category = "Teens"; } $result = mysql_query("SELECT * FROM rooms WHERE category = '$category'"); ?> <table wpgidth="2100" border="0"> <tr> <td> <? $pgid = $_GET["pgid"]; if ($pgid == "") { $pgid = "0"; } ?> <div id="tnt_pagination">Pages <span class="active_tnt_link"> <? for ($i = 0; $i < mysql_num_rows($result); $i++) { if (!strstr($i/"10", ".")) { if ($pgid != $i) { ?> <a href="?pgid=<?=$i?>"><? } ?><?=$i/"10" + 1?><? if ($pgid != $i) { ?></a><? } } } ?></span> </div> <img src="http://bumblebeechat.net/icons/earth.png"><strong>Official Groups <img src="http://bumblebeechat.net/icons/users.png">Supported Groups</strong></p></td> </tr> </table> <table style="border:1px solid #2E64FE; background-color:#E9F4FA; width:100%;"> <tr> <td align="center" width="29%"><p class="bing"><strong>Roomname</strong></p></td> <td align="center" width="60%"><p class="bing"><strong>Topic</strong></p></td> </tr> </table> <? # display pgid number links $num_rows = mysql_num_rows($result); if(!$result || ($num_rows < 0)){ echo "<strong>Couldn't show you my results!</strong>"; return; } if($num_rows == 0){ echo "<strong>Couldn't find any rooms! Someone still need to create a first room!</strong>"; return; } # Display table contents */ $e = true; for($i=$pgid; $i < $pgid + "10"; $i++){ if ($i >= $num_rows) { ?> <? return; } $name = mysql_result($result,$i,"name"); $epuid = bin2hex($name); $about = mysql_result($result,$i,"about"); $level = mysql_result($result,$i,"level"); //echo $about; ?> <table width="100%"> <tr> <td width="200" style="border:1px solid #2E64FE;"><p class="bing"><?php if($level == 1) { echo "<img src='http://bumblebeechat.net/icons/earth.png' width='25' height='25'>" ; } else if($level == 2) { echo "<img src='http://bumblebeechat.net/icons/users.png' width='25' height='25'>" ; } ?></p><p class="bing"><strong><a href="chat.php?rm=<?=$name;?>"><?=$name;?></a></strong</p></td> <td width="500" style="border:1px solid #2E64FE;"><?=$about;?></td> </tr> </table> <? } ?> many thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now