Jump to content

Monk3h

Members
  • Posts

    223
  • Joined

  • Last visited

    Never

Posts posted by Monk3h

  1. Parse error: syntax error, unexpected T_STRING in /home/monk3h/public_html/alog.php on line 19

     

     

     

    <?php $title = "Admin Log"; include("header.php"); ?>
    
    <?php
    if ($stat[rank] != Admin) {
    print "You're not an admin.";
    include("footer.php");
    exit;
    }
    ?>
    <img src=images/trash.gif align=right border=0>This is your 
    event log. Clear the Log? <a href=log.php?action=clear>Yup</a><br><br>
    <table cellspacing=0>
    <?php
    
    $lsel = mysql_query("SELECT * FROM  `alog` WHERE `owner` = 'Admin' ORDER BY `id` DESC LIMIT 100");
    if($lsel){
    while ($log = mysql_fetch_array($lsel)) {
    }
    }else{
      die("Unable to connect to database. ".mysql_error());
    }
    
    print "<tr 
    onmouseover=\"this.style.backgroundColor='EDD5AB';\" 
    onmouseout=\"this.style.backgroundColor='';
    \"><td>$log[log]<br>";
    
    if ($action == clear) {
    print ("Log Cleared!");
    } 
    ?>
    </table>
    
    <?php include("footer.php"); ?>

     

     

    Thats the entire script so far.

  2. MySQL said: 

     

    #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 '$lsel = mysql_query("select * from alog where owner=Admin

    order by id desc lim' at line 1

  3.  

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/monk3h/public_html/alog.php on line 16

     

    What did i do wrong? :S

     

    $lsel = mysql_query("select * from alog where owner=Admin 
    order by id desc limit 100");
    while ($log = mysql_fetch_array($lsel)) {     // Line 16

  4. Right, i need help with a battle script for my game.

     

    Its not going too be too complicated i hope i just need a few ideas on where to start. Ofc if anyone has some spare time on there hands an wishes too help me further that would be great!

     

    Basicly im trying to make a battle script for Army vs Army kind of thing. Each each tribe can buy there own troops of diferent verietys and then send them at the other tribe to fight!

     

    Each unit type has there own HP and dmg points. but id like for some units to be more efective against certain types of units so people dont just buy loads of the 'best' unit type.

     

    I have a table for the troops and there is a row for each type of unit. The feilds in this table are.

     

    id, name, type, cost, desciprion, hp, dmg, fire.

     

     

    hp = health

     

    dmg =  Damage

     

    fire = what place it fires in the battle.

     

     

    I need my script to select the first unit to fire by its 'fire' then have the dmg done reduce all the units its fireing ats 'hp' over an average. Then update how many units died (if a units hp reaches 0 it dies) then select the second unit to fire and do this over and over untill the last unit has fired. Not untill some one has lost all there units but untill 1 of each unit has had its turn.

     

    Any Advice/help? XD

  5. I have a problem with my interest script. every player has a bank account in my game, there bank account name and interest rates are stoped in the players table. The interest is given out in the reset script which controlls all the resets for my game. I am having a problem with giving the players there individual rates of interest. The code i am using at the moment does not work which isnt suprising as its a shot in the dark. Im really stuck here.. How would i give each player there interest thru my reset script?

     

     

    This is the script im using so far to give you an idea of what im tying to do.

     

    $bank = mysql_fetch_array(mysql_query("select * from players")); 
    $int = ($bank[bank] / 100);
    $interest = ($int * $bank[interest]);
    mysql_query("update players set bank=bank+$interest");

  6. if ($step == upgrade) {
    
    if ($stat[bank] < $bankmin) {
    
    Print "You do not have the required funds in your account to Upgrade! Please transfer the required funds!";
    
    }else{
    
    mysql_query("update players set bankaccount=$newbank[name] where id=$stat[id]");
    
    Print "You have successfully upgraded your account to our $newbank[name]";
    
    }}
    

     

    Can anyone tell me why this isnt working? Its displaying the text when i upgrade saying iv upgraded. But it dosnt  change the bankaccount feild in Players to the new Bank account. :s

  7. Return: select * from bank where id = '1 + 1'

     

     

     

    Thats correct i believe.. ID 1 is the current bank account and 1+1 = 2 which is the ID i want.

     

    But the entry where ID = 2 isnt being displayed. The entry for ID 1 is being Redisplayed.

  8. $bankaccount = ($stat[bankaccount]);
    $bank = mysql_fetch_array(mysql_query("select * from bank where name='$bankaccount'"));
    $query = "select * from bank where id = '{$bank['id']} + 1'";
    $result = mysql_query($query) OR die (mysql_error());
    $newbank = mysql_fetch_array($result);
    
    $bankmin = ($newbank[min] - $stat[bank]);
    $interestinc = ($newbank[interest] - $bank[interest]);

  9. It just dosnt work.. It displays the $bank details back instead of the $newbank. asif the +1 on the id feild isnt being aplied.

     

     

    I really have no idea.. So annoying.. Its gotta be the smallest script iv ever wrighten and its not working. :s

×
×
  • 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.