Monk3h
-
Posts
223 -
Joined
-
Last visited
Never
Posts posted by Monk3h
-
-
Parse error: syntax error, unexpected T_VARIABLE in /home/monk3h/public_html/troops.php on line 55
Edit: This is a copy of the script before any Errors Apeared.. It just wouldnt Perform ?step
<?php $title = "Troops"; include("header.php"); ?> <?php $mytribe = mysql_fetch_array(mysql_query("select * from tribes where id=$stat[tribe]")); $devcount = mysql_fetch_array(mysql_query("select * from dev where id=$mytribe[devcount]+1")); $unit1 = mysql_fetch_array(mysql_query("select * from troops where id=1")); $unit2 = mysql_fetch_array(mysql_query("select * from troops where id=2")); $unit3 = mysql_fetch_array(mysql_query("select * from troops where id=3")); $unit4 = mysql_fetch_array(mysql_query("select * from troops where id=4")); Print "Here are all the Offensive and Defensive units your tribe has currently Developed..<br><br>ATTENTION! All Hail <b>$mytribe[name]!</b><br><br>"; Print" <table width=95% border=0> <tr> <td><center><b>Name</b></center></td> <td><center><b>Cost</b></center></td> <td><center><b>Amount</b></center></td> <td><center><b>Buy</b></center></td> </tr> <tr> <td colspan=4><center><b>Description</b></center></td> </tr> </table><br><br>"; if ($mytribe[devcount] >=1){ Print"<form method=post action=troops.php?step=unit1> <table> <tr> <td><center>$unit1[name]</center></td> <td><center>$unit1[cost] Credits</center></td> <td><center><input type=text name=aunit1></b></center></td> <td><center><input type=submit value=Buy></form></center></td> </tr> <tr> <td colspan=4><center><i>$unit1[description]</i></center></td> </tr> </table>"; if (step == unit1){ $amm1 = ($unit1[cost]*$aunit); if ($mytribe[credits] < $amm1){ Print "Your Tribe Does not have that many Credits."; }else{ Print "You Bought $aunit $unit1[name] for Your tribe at a cost of $amm1 Credits"; mysql_query("update tribes set credits=credits-$amm1 where id=$mytribe[id]"); mysql_query("update tribes set unit1=unit1+$aunit1 where id=$mytribe[id]"); }}} if ($mytribe[devcount] >=2){ Print"<form method=post action=troops.php?step=unit2> <table> <tr> <td><center>$unit2[name]</center></td> <td><center>$unit2[cost] Credits</center></td> <td><center><input type=text name=aunit2></b></center></td> <td><center><input type=submit value=Buy></form></center></td> </tr> <tr> <td colspan=4><center><i>$unit2[description]</i></center></td> </tr> </table>"; if (step == unit2){ $amm2 = ($unit1[cost]*$aunit); if ($mytribe[credits] < $amm2){ Print "Your Tribe Does not have that many Credits."; }else{ Print "You Bought $aunit $unit1[name] for Your tribe at a cost of $amm1"; mysql_query("update tribes set credits=credits-$amm2 where id=$mytribe[id]"); mysql_query("update tribes set unit2=unit2+$aunit2 where id=$mytribe[id]"); }}} if ($mytribe[devcount] >=3){ Print"<form method=post action=troops.php?step=unit3> <table> <tr> <td><center>$unit3[name]</center></td> <td><center>$unit3[cost] Credits</center></td> <td><center><input type=text name=aunit3></b></center></td> <td><center><input type=submit value=Buy></form></center></td> </tr> <tr> <td colspan=4><center><i>$unit3[description]</i></center></td> </tr> </table>"; if (step == unit3){ $amm3 = ($unit1[cost]*$aunit); if ($mytribe[credits] < $amm3){ Print "Your Tribe Does not have that many Credits."; }else{ Print "You Bought $aunit $unit1[name] for Your tribe at a cost of $amm1"; mysql_query("update tribes set credits=credits-$amm3 where id=$mytribe[id]"); mysql_query("update tribes set unit3=unit3+$aunit3 where id=$mytribe[id]"); }}} if ($mytribe[devcount] >=4){ Print"<form method=post action=troops.php?step=unit4> <table> <tr> <td><center>$unit4[name]</center></td> <td><center>$unit4[cost] Credits</center></td> <td><center><input type=text name=aunit4></b></center></td> <td><center><input type=submit value=Buy></form></center></td> </tr> <tr> <td colspan=4><center><i>$unit4[description]</i></center></td> </tr> </table>"; if (step == unit4){ $amm4 = ($unit1[cost]*$aunit); if ($mytribe[credits] < $amm4){ Print "Your Tribe Does not have that many Credits."; }else{ Print "You Bought $aunit $unit1[name] for Your tribe at a cost of $amm1"; mysql_query("update tribes set credits=credits-$amm4 where id=$mytribe[id]"); mysql_query("update tribes set unit4=unit4+$aunit4 where id=$mytribe[id]"); }}} ?> <?php include("footer.php"); ?>
-
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/monk3h/public_html/troops.php on line 55
Line 55: mysql_query("update tribes set credits=credits-$amm1 where id=$mytribe['id']");
-
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/monk3h/public_html/troops.php on line 50
Line 50: Print "You Bought $aunit $unit1['name'] for Your tribe at a cost of $amm1 Credits";
-
That Brings back an error, its not any combination of adding or removing ' iv already tried that.. :/
-
For some reason when i click the Buy button it goes to the troops.php?step=unit1 URL but Nothing Happends
Here is a snipit of the code..
if ($mytribe[devcount] >=1){ Print"<form method=post action=troops.php?step=unit1> <table> <tr> <td><center>$unit1[name]</center></td> <td><center>$unit1[cost] Credits</center></td> <td><center><input type=text name=aunit1></b></center></td> <td><center><input type=submit value=Buy></form></center></td> </tr> <tr> <td colspan=4><center><i>$unit1[description]</i></center></td> </tr> </table>"; if (step == unit1){ $amm1 = ($unit1[cost]*$aunit); if ($mytribe[credits] < $amm1){ Print "Your Tribe Does not have that many Credits."; }else{ Print "You Bought $aunit $unit1[name] for Your tribe at a cost of $amm1 Credits"; mysql_query("update tribes set credits=credits-$amm1 where id=$mytribe[id]"); mysql_query("update tribes set unit1=unit1+$aunit1 where id=$mytribe[id]"); }}}
-
Problem Solved..
-
Thank you both VERY much but i cant seem to get it to work..
<?php $title = "Developments"; include("header.php"); ?> <?php $mytribe = mysql_fetch_array(mysql_query("select * from tribes where id=$stat[tribe]")); $devcount = mysql_fetch_array(mysql_query("select * from dev where id=$mytribe[devcount]+1")); Print "Here is where you keep your Tribe up to date with the latest Defensive and Offensive Technologies! Remember.. Nothing is Impossible when you have a Tank!<br><Br><br><br>"; Print "Your Tribe Currently have <b>$mytribe[devcount]</b> Developments Completed.<br><br>"; if ($mytribe[devtime] > 0){ Print "Your Tribe is currently Developing <b>$devcount[name],</b> this development will be completed in Approximately <b>$mytribe[devtime]</b> Hours.<br><br>"; } Print "<b><u>Avalible Developments</u></b><br><br>"; Print" <table border='0' bordercolor='' width='95%' bgcolor=''> <tr> <td><b>Development Name</b></td> <td><b>Time Required</b></td> <td><b>Cost</b></td> <td><b>Action</b></td> </tr> <tr> <td>$devcount[name]</td> <td>$devcount[time]</td> <td>$devcount[cost]</td> <td><a href=development.php?action=start>Start</a> </tr> </table>"; if ($action == start) { if ($stat[id] == !$mytribe[owner]) { Print "You are not the Tribe Owner, you dont have the authority to start a Development"; } elseif ($mytribe[devtime] > 0){ Print "<br><br><br>You are Currently Developing <b>$devcount[name]</b>, you cannot do 2 Developments at once!"; }else{ if ($mytribe[credits] < $devcount[cost]){ Print "<br><br><br>Your Tribe does not have enough Credits for that Development!"; }else{ mysql_query("update tribes set credits=credits-$devcount[cost] where id=$mytribe[id]"); mysql_query("update tribes set devtime=devtime+$devcount[time] where id=$mytribe[id]"); Print "<br><br><br> Your Tribe has started <b>$devcount[name]</b><br>This Development will take Approximately <b>$devcount[time]</b> Hours<br>This development cost your Tribe <b>$devcount[cost]</b> Credits"; }}} ?> <?php include("footer.php"); ?>
Thats my Script.. How would i put that code into this Script? one Give me the uneeded $end error the other Says Wrong Syntax. :/
-
How would i get something in my database to be listed on a page?
For example, i want every development name in the development table with an ID Less than the current development ID to be listed, seperated by a ,.
So if the current development being developed was number 5 i woulod want this to be listed.
DEV 1 Name, DEV 2 Name, DEV 3 Name, DEV 4 Name.
How would i do this? :/
-
Sorry for wasting your Time guys, the problem was the [tribe] Part, I removed that and it works now.. I have no idea why i put that in or What i was thinking.
Sorry again and thanks for your Insanely Fast Responses!
-
Dosnt seem to like the second Line That i post (2nd line is line 4 in my Script) Can anyone tell me whats wrong with it.. I have a feeling its the +1, if so could some one please sugest another way of doing this?
$mytribe = mysql_fetch_array(mysql_query("select * from tribes where id=$stat[tribe]")); $devcount = mysql_fetch_array(mysql_query("select * from dev where id=$mytribe[devcount]+1[tribe]"));
-
Yea man, Cheers.. Its been a while since iv last programmed PHP. Bit drunk now.. Will change it later. PHP + Booz = Baaaaad.
-
Done.. No more error But i still have the same probem as before.. the Yaaaar Text isnt Apearing when you click/view the link.
<?php $title = "Gem Store"; include("header.php"); ?> <b>Store Owner:</b> Welcome to my store! Here you can <i>Buy</i> and <i>Sell</i> many diferent Priceless Stones..<br><br><br> <?php if ($stat[gembag] == n ) { Print "<b>Store Assistant:</b> You dont appear to have a <i>Gem Bag</i>! How do you expect to collect all the precious stones that are available in this wonderful Town?<br><br>"; Print "<b>Store Assistant:</b> Here, take this.. Its on the house, but dont get telling people we do FreeBs!<br><br>"; Print "The store Assistant hands you a <b>Small Gem Bag<br><br><br></b>"; Print "[<A href=seccity.php>Back to Town?</a>]"; mysql_query("update players set gembag='s' where id=$stat[id]"); include("footer.php"); exit; } else { Print "<b>Store Assistant:</b> How are you getting on with that <i>Small Gem Bag</i>?<br> Normally you could upgrade that tiny thing! (For a Small Fee) But right now we are out of Stock.<br><br><br>"; Print "[<A href=gemstore.php?view=smith>Visit the Gem Smith</a>] [<A href=seccity.php>Back to Town</a>]"; include("footer.php"); exit; } if ($_GET['view'] == 'smith') { print "Yaaaarrrr"; include("footer.php"); exit; } ?> <?php include("footer.php"); ?>
-
Done, now i get this Error.
Parse error: syntax error, unexpected '}' in /home/monk3h/public_html/gemstore.php on line 27
<?php $title = "Gem Store"; include("header.php"); ?> <b>Store Owner:</b> Welcome to my store! Here you can <i>Buy</i> and <i>Sell</i> many diferent Priceless Stones..<br><br><br> <?php if ($stat[gembag] == n ) { Print "<b>Store Assistant:</b> You dont appear to have a <i>Gem Bag</i>! How do you expect to collect all the precious stones that are available in this wonderful Town?<br><br>"; Print "<b>Store Assistant:</b> Here, take this.. Its on the house, but dont get telling people we do FreeBs!<br><br>"; Print "The store Assistant hands you a <b>Small Gem Bag<br><br><br></b>"; Print "[<A href=seccity.php>Back to Town?</a>]"; mysql_query("update players set gembag='s' where id=$stat[id]"); include("footer.php"); exit; } else { Print "<b>Store Assistant:</b> How are you getting on with that <i>Small Gem Bag</i>?<br> Normally you could upgrade that tiny thing! (For a Small Fee) But right now we are out of Stock.<br><br><br>"; Print "[<A href=gemstore.php?view=smith>Visit the Gem Smith</a>] [<A href=seccity.php>Back to Town</a>]"; include("footer.php"); exit } if ($_GET['view'] == 'smith') { print "Yaaaarrrr"; include("footer.php"); exit; } ?> <?php include("footer.php"); ?>
-
I cant figure out why when i go to the ?view=smith Link the text i inputed as a text doesnt apear :S
<?php $title = "Gem Store"; include("header.php"); ?> <b>Store Owner:</b> Welcome to my store! Here you can <i>Buy</i> and <i>Sell</i> many diferent Priceless Stones..<br><br><br> <?php if ($stat[gembag] == n ) { Print "<b>Store Assistant:</b> You dont appear to have a <i>Gem Bag</i>! How do you expect to collect all the precious stones that are available in this wonderful Town?<br><br>"; Print "<b>Store Assistant:</b> Here, take this.. Its on the house, but dont get telling people we do FreeBs!<br><br>"; Print "The store Assistant hands you a <b>Small Gem Bag<br><br><br></b>"; Print "[<A href=seccity.php>Back to Town?</a>]"; mysql_query("update players set gembag='s' where id=$stat[id]"); include("footer.php"); exit; } else { Print "<b>Store Assistant:</b> How are you getting on with that <i>Small Gem Bag</i>?<br> Normally you could upgrade that tiny thing! (For a Small Fee) But right now we are out of Stock.<br><br><br>"; Print "[<A href=gemstore.php?view=smith>Visit the Gem Smith</a>] [<A href=seccity.php>Back to Town</a>]"; include("footer.php"); exit } if ($view == smith) { print "Yaaaarrrr"; include("footer.php"); exit; } ?> <?php include("footer.php"); ?>
-
W00t.. Works now, Thanks dude!
So Why do i need the Double == whats the diference? :S
-
Right, this Code 'Should work' and yet dosnt.. Its the PHP and not the SQL because instead of just displaying the 'else' Part of the code when i have Gembag as s it still displays the first bit. Now i know it gives me the gembag and changes it to 's' from 'n' in the database but it still only shows the first if part of the code and not the else. :s
<?php $title = "Gem Store"; include("header.php"); ?> <b>Store Owner:</b> Welcome to my store! Here you can <i>Buy</i> and <i>Sell</i> many diferent Priceless Stones..<br><br><br> <?php if ($stat[gembag] = n ) { Print "<b>Store Assistant:</b> You dont appear to have a <i>Gem Bag</i>! How do you expect to collect all the precious stones that are available in this wonderful Town?<br><br>"; Print "<b>Store Assistant:</b> Here, take this.. Its on the house, but dont get telling people we do FreeBs!<br><br>"; Print "The store Assistant hands you a <b>Small Gem Bag</b>"; mysql_query("update players set gembag='s' where id=$stat[id]"); include("footer.php"); exit; } else { Print "<b>Store Assistant:</b> How are you getting on with that <i>Small Gem Bag</i>? Normally you could upgrade that tiny thing! (For a Small Fee) But right now we are out of Stock."; include("footer.php"); exit; } ?> <?php include("footer.php"); ?>
-
Any sugestions on a good Editor? At the moment im using Crimson Editor and Notepad.
-
N is content in my database, that is not the problem i am 100% sure of this as im using the same thing in other working scripts.
-
Too keep things clear..
<?php $title = "The Safety Deposit Boxes"; include ("header.php"); ?> <?php if ($stat[travelpass] <= N ) { Print "<b>Dusty old man:</b> You shouldnt be down here without a Travel Pass! Shoo, before i get you banned from here Completely!"; } else { Print "<b>Dusty old man:</b> Welcome the Safety Deposit Box Area, not many people come down here anymore.. Well then, Whats ya business?"; print "<ul>"; print "<li><a href=box.php?action=box>Open a box</a>"; print "</ul>"; if ($action == box) { $chance = rand(1,; mysql_query("update players set keys=keys-1 where id=$stat[id]"); if ($chance == 1) { print "As you turn the key in the lock you here a faint fluttering sound.. Nothing here but butterflies!"; } if ($chance == 2) { print "You found a <i>Diamond!</i>.. No wait, thats just a shiney rock."; } if ($chance == 3) { $crgain = rand(1,10000); print "Credits, millions of them! <b>$crgain</b> to be more precise."; mysql_query("update players set credits=credits+$crgain where id=$stat[id]"); } if ($chance == 4) { print "Nothin' interesting can be seen."; } if ($chance == 5) { print "What was that?"; } if ($chance == 6) { $plgain = rand(1,100); print "Pft.. Just a lump of ore.. No wait! Thats no ordinary ore! You found <b>$plgain</b> platinum."; mysql_query("update players set platinum=platinum+$plgain where id=$stat[id]"); } if ($chance == 7) { $roll = rand(1,20); if ($roll == 15) { print "As you open the box door the stench of Stagnent Water overwhelms your sences! Inside you fine a vile or murky liquid."; mysql_query("update players set elixer=elixer+1 where id=$stat[id]"); } else { print "Ewwwwww! its a dead fish! Cant of been here for long as it seems to still be edible! <b>1</b> Bass gained!"; mysql_query("update players set bass=bass+1 where id=$stat[id]"); } } if ($chance == { print "The key breaks off in the lock.."; } $keysleft = ($stat[keys] - 1); print "<br><br>... <a href=box.php?action=box>Open</a> another box? (<b>$keysleft</b> Keys left.)"; } } else { print "<b>Dusty old man:</b> You dont have the key for that box, infact you dont have a key for any of these Boxes, get outa here! <br><br> <a href=travel.php>Leave</a>"; } ?> <?php include("footer.php"); ?>
Error: Parse error: syntax error, unexpected T_ELSE in /home/monk3h/public_html/box.php on line 59
-
Changing it to
}
else {
Just moved the error down a line.. :/
the if ($stat[travelpass] <= N ) { is the make sure the user has the pass needed to be in that area..
Edit: I missunderstood what you said and have tried chaging both Else to
} else {
and
} else {
Nether worked..
-
This error has been annoying for far too long now.. Stupid little things keep going wrong with my script when i change the slightest things and i have no idea why!?
Heres the Code:
<?php $title = "The Safety Deposit Boxes"; include ("header.php"); ?> <?php if ($stat[travelpass] <= N ) { Print "<b>Dusty old man:</b> You shouldnt be down here without a Travel Pass! Shoo, before i get you banned from here Completely!"; } else { Print "<b>Dusty old man:</b> Welcome the Safety Deposit Box Area, not many people come down here anymore.. Well then, Whats ya business?"; print "<ul>"; print "<li><a href=box.php?action=box>Open a box</a>"; print "</ul>"; if ($action == box) { $chance = rand(1,; mysql_query("update players set keys=keys-1 where id=$stat[id]"); if ($chance == 1) { print "As you turn the key in the lock you here a faint fluttering sound.. Nothing here but butterflies!"; } if ($chance == 2) { print "You found a <i>Diamond!</i>.. No wait, thats just a shiney rock."; } if ($chance == 3) { $crgain = rand(1,10000); print "Credits, millions of them! <b>$crgain</b> to be more precise."; mysql_query("update players set credits=credits+$crgain where id=$stat[id]"); } if ($chance == 4) { print "Nothin' interesting can be seen."; } if ($chance == 5) { print "What was that?"; } if ($chance == 6) { $plgain = rand(1,100); print "Pft.. Just a lump of ore.. No wait! Thats no ordinary ore! You found <b>$plgain</b> platinum."; mysql_query("update players set platinum=platinum+$plgain where id=$stat[id]"); } if ($chance == 7) { $roll = rand(1,20); if ($roll == 15) { print "As you open the box door the stench of Stagnent Water overwhelms your sences! Inside you fine a vile or murky liquid."; mysql_query("update players set elixer=elixer+1 where id=$stat[id]"); } else { print "Ewwwwww! its a dead fish! Cant of been here for long as it seems to still be edible! <b>1</b> Bass gained!"; mysql_query("update players set bass=bass+1 where id=$stat[id]"); } } if ($chance == { print "The key breaks off in the lock.."; } $keysleft = ($stat[keys] - 1); print "<br><br>... <a href=box.php?action=box>Open</a> another box? (<b>$keysleft</b> Keys left.)"; } } else { print "<b>Dusty old man:</b> You dont have the key for that box, infact you dont have a key for any of these Boxes, get outa here! <br><br> <a href=travel.php>Leave</a>"; } ?> <?php include("footer.php"); ?>
$Step not Working
in PHP Coding Help
Posted
Notice: Use of undefined constant step - assumed 'step' in /home/monk3h/public_html/troops.php on line 42
Notice: Use of undefined constant unit1 - assumed 'unit1' in /home/monk3h/public_html/troops.php on line 42
Notice: Use of undefined constant devcount - assumed 'devcount' in /home/monk3h/public_html/troops.php on line 61
Notice: Use of undefined constant step - assumed 'step' in /home/monk3h/public_html/troops.php on line 78
Notice: Use of undefined constant unit2 - assumed 'unit2' in /home/monk3h/public_html/troops.php on line 78
Notice: Use of undefined constant devcount - assumed 'devcount' in /home/monk3h/public_html/troops.php on line 95
Notice: Use of undefined constant step - assumed 'step' in /home/monk3h/public_html/troops.php on line 112
Notice: Use of undefined constant unit3 - assumed 'unit3' in /home/monk3h/public_html/troops.php on line 112
Notice: Use of undefined constant devcount - assumed 'devcount' in /home/monk3h/public_html/troops.php on line 130