Leven and Gender Variables

Results 1 to 3 of 3
  1. #1
    Apprentice amorac is offline
    MemberRank
    Feb 2009 Join Date
    11Posts

    Leven and Gender Variables

    I am working on my own cms (is that the correct term for player creation page?) - I know there are very nice ones out there, however I like to make my own, so that I have a better understanding on how they work :-) ( see it here )

    My roadblock I have come across is this: How do you extract the Level and Gender of a player. The rest I have figured out, But this one stumps me. I have checked other cms source code, and the process seems to be quite elaborate. Is this by design for the cms or is there a shorter way to grab those two variables?

    Thank you in advance for any help offered.

    ps.
    I did some extensive search for this issue both on here and other forums, but the search results seem to give out hundreds of post, not related to "level" and "gender" or any combination of this search pattern. so if this has been addressed, I apologize and ask if you can link me to the correct post.

    using: Mangos /0.13.0-DEV Rev: 7301


  2. #2
    Proficient Member PHandels is offline
    MemberRank
    Oct 2008 Join Date
    NetherlandsLocation
    185Posts

    Re: Leven and Gender Variables

    Depends on it...
    If u making a CMS u making a "content managment site" (e107/phpnuke/postnuke/dragonfly for example) a site where its easy to change and add content for people without having to know any web programming language like html php etc.
    So if its just a registration page which shows online players/level etc like "regacc" for example... thats not a cms..
    But "mangosweb" for example is a cms :)

    Good luck with your project :)
    My reply not really helping... and i know nothing about how to write a page/website for mangos, only how to install and maintain and edit a allready existing cms because i used some of them in the past.
    I just wanted to explain what a cms is :D

  3. #3
    Omega FragFrog is offline
    MemberRank
    Aug 2004 Join Date
    The NetherlandsLocation
    5,630Posts

    Re: Leven and Gender Variables

    Problem is that the mangos developers sucked at making coherent database models. As a result, there is no 'field' for either gender nor level - instead, it is part of a big data field containing numerous entries.

    First, you must obtain this data as a whole (there are features in MySQL to only substract that which you need, but in my experience it's usually faster to load a bit more data into memory than perform slow algorithms at retrieval time). If you have some experience running queries on your databases, this should not be all too hard:
    PHP Code:
    SELECT    `data`,
              `
    name`
    FROM      `characters
    For your site you'll probably want to join on other tables as well, but this gives you the names and data of your characters at least.

    Generally, your DBAL will return the result in either an array or object (depending on wether you use mysql_fetch_assoc or mysql_fetch_object). I'll assume you did the first, since it's more intuitive to work with in my experience:
    PHP Code:
    foreach ($result as $row) {
      
    $data explode(' '$row['data']);
      echo 
    $row['name'] . ' ' $data[34] . '<br>';

    This gives you a list of characters with their level - the 34th entry in the data column. There is undoubtedly also a field in there for gender, but I do not know which one that might be - I assume it can be found in other websites though.



Advertisement