Page 1 of 1

help please

Posted: Wed Aug 10, 2011 2:38 pm
by thorian
well im sorta confused of how to accomplish this script.. I want to make a drop down menu to select creatures from to battle. and something else im confused about is making an experience echo from current to next...
srry on android.

Re: help please

Posted: Wed Aug 10, 2011 7:18 pm
by Nexus
make your creature query
then you are going to do a while loop

Code: Select all

while($creatureinfo3 = mysql_fetch_array($creatureinfo2)) {
echo "<select>
         <option>$creatureinfo3['name']</option>
        </select>";
}

Re: help please

Posted: Wed Aug 10, 2011 9:12 pm
by thorian
thx man. so simple lol. so.. what about exp though. I have no idea

Re: help please

Posted: Wed Aug 10, 2011 9:34 pm
by Xaleph
Code has a bug, this way you create a select for every monster right?

echo 'select name="monster">';

while(){
echo $someMonsterVal;
}

echo '</select>';

Re: help please

Posted: Wed Aug 10, 2011 9:40 pm
by thorian
im confused at ur code xal :/ ill try tinkering when I get home from work if u haven't responded before then

Re: help please

Posted: Wed Aug 10, 2011 9:43 pm
by Xaleph

Code: Select all

By Nexus:

Code: Select all
    while($creatureinfo3 = mysql_fetch_array($creatureinfo2)) {
    echo "<select>
             <option>$creatureinfo3['name']</option>
            </select>";
    }

The only problem is that you are creating a select for each $creature. That`s not good right? You want all creatures in 1 select. So i`m suggesting to echo the select outside the while loop.

Code: Select all

    echo '<select>';
    while($creatureinfo3 = mysql_fetch_array($creatureinfo2)) {
    echo "<option>$creatureinfo3['name']</option>";
    }
    echo '</select>';

Re: help please

Posted: Wed Aug 10, 2011 10:52 pm
by thorian
oooh. I understand. thxxx :)
. xal do u know how to generate an echo til next lvl up / exp til.

Re: help please

Posted: Wed Aug 10, 2011 11:25 pm
by Nexus
well put this in the statpanel if it doesn't already show exper(haven't messed with the tutorial in a long time :P)

Code: Select all

echo "$playerinfo3['exper'] / $playerinfo3['experneeded']"

Re: help please

Posted: Thu Aug 11, 2011 12:14 am
by thorian
luv

Re: help please

Posted: Thu Aug 11, 2011 12:51 am
by Nexus
:) glad I could help