Monk3h Posted May 29, 2008 Share Posted May 29, 2008 I dont understand what iv done wrong here? Error is on line 69 <?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 different Priceless Stones..<br><br><br> <?php if ($stat[gembag] == 0 ) { 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> The only way to get a Gem Bag is from a certain person in Silverlake.<br><br>"; Print "[<A href=tricity.php>Back to Town?</a>]"; include("footer.php"); exit; } else { Print "<b>Store Assistant:</b> How are you getting on with that "; if ($stat[gembag] == 1) { print "<i>Small Gem Bag</i>"; } if ($stat[gembag] == 2) { print "<i>Gem Bag</i>"; } print "?<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=tricity.php>Back to Town</a>]"; if ($view == smith) { print "<br><br><br><br><b>Gemsmith:</b> I suppose you want me to turn them Puny things into something a little.. Bigger? Well its gonna cost ya <i>250</i> Credits Per Medium and <i>1000</i> Credits per Large. I must warn you, Gem smithing isnt an exact Science, things tend to go wrong.. at your Expense!"; Print "<br><br>[<a href=gemstore.php?view=topaz>Topaz</a>] [<a href=gemstore.php?view=emerald>emeralds</a>] [<a href=gemstore.php?view=ruby>Rubys</a>] [<a href=gemstore.php?view=sapphire>Sapphires</a>]"; if ($stat[shaman] >= { print "<br><br><a href=gemstore.php?view=work>Work for the Gem Smith</a>"; } } if ($view == topaz) { Print "<br><br><br><br>You currently have <b>$stat[scrystals] Small Topaz</b> and <b>$stat[mcrystals] Medium Topaz</b> in your Possesion.<br><br>What would you like to do?<br><br><br></b>"; Print "[<a href=gemstore.php?step=mtopaz>Make a Medium Topaz</a>]"; if ($stat[gsmith] == 1) { print " [<a href=gemstore.php?step=ltopaz>Make a Large Topaz</a>]"; } } if ($step == mtopaz) { if ($stat[credits] < 250){ Print "<br><br><br>You only have $stat[credits] Credits. Thats not enough!"; include ("footer.php"); } elseif ($stat[scrystals] < 10){ Print "<br><br><br><br>You only have $stat[scrystals] Topaz. Thats not enough!"; }else{ mysql_query("update players set credits=credits-250 where id=$stat[id]"); mysql_query("update players set scrystals=scrystals-10 where id=$stat[id]"); mysql_query("update players set mcrystals=mcrystals+1 where id=$stat[id]"); Print"<br><br><br><b>Success!!</b>.. You gained <i>1 Medium Topaz</i>!"; }} if ($step == ltopaz) { elseif ($stat[credits] < 1000){ // ERROR Print "<br><br><br>You only have $stat[credits] Credits. Thats not enough!"; include ("footer.php"); } elseif ($stat[mtopaz] < 10){ Print "<br><br><br><br>You only have $stat[mcrystals] Topaz. Thats not enough!"; }else{ mysql_query("update players set credits=credits-250 where id=$stat[id]"); mysql_query("update players set mcrystals=mcrystals-10 where id=$stat[id]"); mysql_query("update players set lcrystals=lcrystals+1 where id=$stat[id]"); Print"<br><br><br><b>Success!!</b>.. You gained <i>1 Large Crystal</i>!"; }} if ($view == emerald) { Print "<br><br><br><br>You currently have <b>$stat[semeralds] Small Emeralds</b> and <b>$stat[memeralds] Medium Emeralds</b> in your Possesion.<br><br>What would you like to do?<br><br><br></b>"; Print "[<a href=gemstore.php?step=memerald>Make a Medium Emeralds</a>]"; if ($stat[gsmith] == 1) { print " [<a href=gemstore.php?step=lemerald>Make a Large Emeralds</a>]"; } } if ($step == memerald) { if ($stat[credits] < 250){ Print "<br><br><br>You only have $stat[credits] Credits. Thats not enough!"; include ("footer.php"); } elseif ($stat[semeralds] < 10){ Print "<br><br><br><br>You only have $stat[semeralds] Emeralds. Thats not enough!"; }else{ mysql_query("update players set credits=credits-250 where id=$stat[id]"); mysql_query("update players set semeralds=semeralds-10 where id=$stat[id]"); mysql_query("update players set memeralds=memeralds+1 where id=$stat[id]"); Print"<br><br><br><b>Success!!</b>.. You gained <i>1 Medium Emerald</i>!"; }} if ($step == lemerald) { if ($stat[credits] < 1000){ Print "<br><br><br>You only have $stat[credits] Credits. Thats not enough!"; include ("footer.php"); } elseif ($stat[memeralds] < 10){ Print "<br><br><br><br>You only have $stat[memeralds] Emeralds. Thats not enough!"; }else{ mysql_query("update players set credits=credits-250 where id=$stat[id]"); mysql_query("update players set memeralds=memeralds-10 where id=$stat[id]"); mysql_query("update players set lemeralds=lemeralds+1 where id=$stat[id]"); Print"<br><br><br><b>Success!!</b>.. You gained <i>1 Large Emerald</i>!"; }} if ($view == ruby) { Print "<br><br><br><br>You currently have <b>$stat[srubys] Small Rubies</b> and <b>$stat[mrubys] Medium Rubiess</b> in your Possesion.<br><br>What would you like to do?<br><br><br></b>"; Print "[<a href=gemstore.php?step=mruby>Make a Medium Rubys</a>]"; if ($stat[gsmith] == 1) { print " [<a href=gemstore.php?step=lruby>Make a Large Rubys</a>]"; } } if ($step == mruby) { if ($stat[credits] < 250){ Print "<br><br><br>You only have $stat[credits] Credits. Thats not enough!"; include ("footer.php"); } elseif ($stat[srubys] < 10){ Print "<br><br><br><br>You only have $stat[srubys] Rubys. Thats not enough!"; }else{ mysql_query("update players set credits=credits-250 where id=$stat[id]"); mysql_query("update players set srubys=srubys-10 where id=$stat[id]"); mysql_query("update players set mrubys=mrubys+1 where id=$stat[id]"); Print"<br><br><br><b>Success!!</b>.. You gained <i>1 Medium Ruby</i>!"; }} if ($step == lruby) { if ($stat[credits] < 1000){ Print "<br><br><br>You only have $stat[credits] Credits. Thats not enough!"; include ("footer.php"); } elseif ($stat[mrubys] < 10){ Print "<br><br><br><br>You only have $stat[mrubys] Rubys. Thats not enough!"; }else{ mysql_query("update players set credits=credits-250 where id=$stat[id]"); mysql_query("update players set mrubys=mrubys-10 where id=$stat[id]"); mysql_query("update players set lrubys=lrubys+1 where id=$stat[id]"); Print"<br><br><br><b>Success!!</b>.. You gained <i>1 Large Ruby</i>!"; }} if ($view == sapphire) { Print "<br><br><br><br>You currently have <b>$stat[ssapphires] Small Sapphires</b> and <b>$stat[msapphires] Medium Sapphires</b> in your Possesion.<br><br>What would you like to do?<br><br><br></b>"; Print "[<a href=gemstore.php?step=msapphire>Make a Medium Sapphires</a>]"; if ($stat[gsmith] == 1) { print " [<a href=gemstore.php?step=lsapphire>Make a Large Sapphires</a>]"; } } if ($step == msapphire) { if ($stat[credits] < 250){ Print "<br><br><br>You only have $stat[credits] Credits. Thats not enough!"; include ("footer.php"); } elseif ($stat[ssapphires] < 10){ Print "<br><br><br><br>You only have $stat[ssapphires] Sapphires. Thats not enough!"; }else{ mysql_query("update players set credits=credits-250 where id=$stat[id]"); mysql_query("update players set ssapphires=ssapphires-10 where id=$stat[id]"); mysql_query("update players set msapphires=msapphires+1 where id=$stat[id]"); Print"<br><br><br><b>Success!!</b>.. You gained <i>1 Medium Sapphire</i>!"; }} if ($step == lsapphire) { if ($stat[credits] < 1000){ Print "<br><br><br>You only have $stat[credits] Credits. Thats not enough!"; include ("footer.php"); } elseif ($stat[msapphires] < 10){ Print "<br><br><br><br>You only have $stat[msapphires] Sapphires. Thats not enough!"; }else{ mysql_query("update players set credits=credits-250 where id=$stat[id]"); mysql_query("update players set msapphires=msapphires-10 where id=$stat[id]"); mysql_query("update players set lsapphires=lsapphires+1 where id=$stat[id]"); Print"<br><br><br><b>Success!!</b>.. You gained <i>1 Large Sapphire</i>!"; }} include("footer.php"); exit; } ?> <?php include("footer.php"); ?> Am i using Else if in an incorect way? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted May 29, 2008 Share Posted May 29, 2008 Does it give you a line number? Quote Link to comment Share on other sites More sharing options...
Monk3h Posted May 29, 2008 Author Share Posted May 29, 2008 Iv modified my post to include the line number error and i have notated the line in the code. Full error: Parse error: syntax error, unexpected T_ELSEIF in /home/monk3h/public_html/gemstore.php on line 69 Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted May 29, 2008 Share Posted May 29, 2008 You just need to put a bracket in front of the line that is giving the error: } elseif ($stat[credits] < 1000){ Quote Link to comment Share on other sites More sharing options...
Monk3h Posted May 29, 2008 Author Share Posted May 29, 2008 That wont fix a thing as the { and } are even, its the first thing i always check. I was gettoing an error because i used an elseif where only an if was required. (stoned) Thanks for your help. Quote Link to comment Share on other sites More sharing options...
soycharliente Posted May 29, 2008 Share Posted May 29, 2008 @poco: It's a brace A bracket is [ (at least that's what I call them). @monk3h: Your code is pretty, uhh, all over the place. Just looking through it at a glance, you've got so much repeated code that you could clean up and make it MUCH easier to read. Also, I can't even follow the if else logic. With so many nested ifs and elses, I really have to wonder if you can even follow it, lol Honestly, you should really look through it and see if you can bring out some of those statements to make it easier. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.