Monk3h
-
Posts
223 -
Joined
-
Last visited
Never
Posts posted by Monk3h
-
-
But i want to Print the content of the alog table in order of ID :s
-
Any arr variables that now have been established via the extract method on the line above T
I'm confused. :s
-
query success
Now what?
-
Ooookay, so whats the error? =/
-
Its the else.
I dont understand why on the line above there is a {
then on the line below there is }else{
Thats just {} isnt that pointless? :S
-
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.
-
After replacing the line to what you said i get
Parse error: syntax error, unexpected T_STRING in /home/monk3h/public_html/alog.php on line 19
-
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
-
Are you sure the syntax of that is right? It dosnt look right, when i Inputted it it just threw errors back at me. :S
-
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
-
Any ideas on how i could make the dmg be done too all the troops equaly?
-
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
-
Thank you both for your help! I used the first Script posted after looking it over as Advised. It works Perfectly!
Your both Life savers! <3
-
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");
-
Thanks guys, i added in the '/' and it works now. XD
-
Could it have somthing to do with the account name having a spcae in it? Do i need to use a diferent Query?
-
update players set bankaccount=Bronze Account where id=2You have successfully upgraded your account to our Bronze Account
So that should work. Thats exactly what i want it to do.. WTF!?
-
Done.. Still not Working.
-
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
-
Works now.. Thanks dude!
Could you briefly explain to me what the difference is beetween the 2?
-
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.
-
$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]);
-
i echos the result if thats what you mean. It reads back
Resource id #10
-
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
MYSQL_Fetch Error
in PHP Coding Help
Posted
id, owner, log, unread