Driiper Posted January 17, 2008 Share Posted January 17, 2008 Hello PHP Freaks i have a some problems with my script, i got a "Parse error: syntax error, unexpected '{' in C:\server\www\www\mafia\thegame\en\make_crew.php on line 2" and i cant se whats wrong with it, can anyone help me? sorry but im a noob :S <? if ($Make_crew) (($geld - 5000000) < 0) { $melding = "You don't have that much money."; } else { $new_current = ($geld - 5000000); UpdateTable(users,geld,$new_current,id,$userid); $opdracht = "insert INTO crews values('','$ikke','500000','$cookieusername','0','0')"; $resultaat = mysql_query($opdracht); $melding = "You have made the crew, $ikke"; ?> Thanks Driiper Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/ Share on other sites More sharing options...
revraz Posted January 17, 2008 Share Posted January 17, 2008 if ($Make_crew) (($geld - 5000000) < 0) { What are you doing with the variable in $Make_crew in regards to $geld? You don't have the if statement correct in regards to parenthesis. if (($Make_crew) (($geld - 5000000) < 0)) { Would be correct but I am not sure what that will do for you. Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-441817 Share on other sites More sharing options...
Driiper Posted January 17, 2008 Author Share Posted January 17, 2008 no that didnt work i will try to explain more if ($crew == 0) { echo "<div class=\"window\">"; echo "<div class=\"mainTitle\">Apply to a clan</div>"; echo "<div class=\"mainText\">"; $lijstGebruikers = "SELECT * FROM crews ORDER BY id ASC"; $resultLijstGebruikers = mysql_query($lijstGebruikers); echo "<form method=\"post\" name=\"form\">"; echo "<select name=\"c\">"; echo "<option value =\"\">Select a clan</option>"; while ($row = mysql_fetch_array($resultLijstGebruikers)) { echo "<option value =\"$row[id]\">$row[name]</option>"; } echo "</select>"; echo "<br /><br /><input type=\"submit\" value=\"Apply\"> "; echo "</form>"; if ($rank > 999) { echo "</div></div>"; echo "<div class=\"window\">"; echo "<div class=\"mainTitle\">Create a Clan</div>"; echo "<div class=\"mainText\">"; ?> <form method="post" action="make_crew.php"> Creating a clan costs $5,000,000 <br /><b>Crew Name:</b><input type=text name=ikke size=20> <br /> <input type=submit value=Create Clan> </form> This is from the form where my users is gonna create a own clan as you se its will go the make_crew.php and then the make_crew.php is supposed to inject the input field called "ikke" to my db. <? if ($Make_crew) (($geld - 5000000) < 0) { $melding = "You don't have that much money."; } else { $new_current = ($geld - 5000000); UpdateTable(users,geld,$new_current,id,$userid); $opdracht = "insert INTO crews values('','$ikke','500000','$cookieusername','0','0')"; $resultaat = mysql_query($opdracht); $melding = "You have made the crew, $ikke"; ?> understand now? Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-441821 Share on other sites More sharing options...
revraz Posted January 17, 2008 Share Posted January 17, 2008 Not really, since you still didn't say what that line is supposed to do. no that didnt work i will try to explain more understand now? Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-441823 Share on other sites More sharing options...
Driiper Posted January 17, 2008 Author Share Posted January 17, 2008 That line is supposed to check if the user have 5.000.000 money if not they get the message that they dont have enough money better ? Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-441829 Share on other sites More sharing options...
revraz Posted January 17, 2008 Share Posted January 17, 2008 Assuming their money is stored in $geld, and $geld is a INT if ($geld >= 5000000) { //they have equal or more } Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-441833 Share on other sites More sharing options...
Driiper Posted January 17, 2008 Author Share Posted January 17, 2008 all i need is to get that syntax error away :-\ anyone know howto? can anyone se the error? if so can you correct it. sorry for my newb Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-442029 Share on other sites More sharing options...
papaface Posted January 17, 2008 Share Posted January 17, 2008 Your code does not make sense! Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-442032 Share on other sites More sharing options...
Driiper Posted January 17, 2008 Author Share Posted January 17, 2008 could you help me to make some sense in it then? Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-442033 Share on other sites More sharing options...
tinker Posted January 17, 2008 Share Posted January 17, 2008 from looking at the first post, you have a '}' missing, yet reading the error, you have a '{' missing, very odd. Syntax error's are about similar to spelling mistakes, in this case you've either over closed or unopened a functional statement (function or logic)... Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-442034 Share on other sites More sharing options...
Driiper Posted January 17, 2008 Author Share Posted January 17, 2008 <? if ($Make_crew) (($geld - 5000000) < 0) { $melding = "You don't have that much money."; } else { $new_current = ($geld - 5000000); UpdateTable(users,geld,$new_current,id,$userid); $opdracht = "insert INTO crews values('','$ikke','500000','$cookieusername','0','0')"; $resultaat = mysql_query($opdracht); $melding = "You have made the crew, $ikke"; ?> If you dont have enough money "$geld" you will get the message that "YOU DONT HAVE THAT MUCH MONEY" but it you have over the ammount 5000000 the db will update your money and create the clan with the clan name the player wrote from the visual site "$ikke" Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-442035 Share on other sites More sharing options...
Driiper Posted January 17, 2008 Author Share Posted January 17, 2008 what i cant get how i can get this error "Parse error: syntax error, unexpected '{' in C:\server\www\www\mafia\thegame\en\make_crew.php on line 2" when it looks like i have all connected. what did i do wrong? btw i tryed to remove it and then i got somthing with T_Variable.. Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-442038 Share on other sites More sharing options...
darkfreaks Posted January 17, 2008 Share Posted January 17, 2008 <?php if ($Make_crew) (($geld - 5000000) < 0) { $melding = "You don't have that much money."; } else { $new_current = ($geld - 5000000); UpdateTable(users,geld,$new_current,id,$userid); $opdracht = "insert INTO crews values('','$ikke','500000','$cookieusername','0','0')"; $resultaat = mysql_query($opdracht); $melding = "You have made the crew, $ikke";} ?> Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-442051 Share on other sites More sharing options...
Driiper Posted January 17, 2008 Author Share Posted January 17, 2008 <?php if ($Make_crew) (($geld - 5000000) < 0) { $melding = "You don't have that much money."; } else { $new_current = ($geld - 5000000); UpdateTable(users,geld,$new_current,id,$userid); $opdracht = "insert INTO crews values('','$ikke','500000','$cookieusername','0','0')"; $resultaat = mysql_query($opdracht); $melding = "You have made the crew, $ikke";} ?> didnt work :/ Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-442077 Share on other sites More sharing options...
revraz Posted January 17, 2008 Share Posted January 17, 2008 I dont understand how my example above didn't work? Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-442084 Share on other sites More sharing options...
Driiper Posted January 17, 2008 Author Share Posted January 17, 2008 I dont understand how my example above didn't work? yay it worked now thanks, but now i get a FATAL error. i know theres somthing wronh with line 8 but i dont know what else to write. anyone know? Fatal error: Call to undefined function updatetable() in C:\server\www\www\mafia\thegame\en\make_crew.php on line 8 <?php if ($geld >= 5000000) { //they have equal or more $melding = "You don't have that much money."; } else { $new_current = ($geld - 5000000); UpdateTable(users,geld,$new_current,id,$userid); <-------- THIS LINE! $opdracht = "insert INTO crews values('','$ikke','500000','$cookieusername','0','0')"; $resultaat = mysql_query($opdracht); $melding = "You have made the crew, $ikke";} ?> Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-442125 Share on other sites More sharing options...
revraz Posted January 17, 2008 Share Posted January 17, 2008 It's calling a Function called UpdateTable. Where is this Function? Quote Link to comment https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/#findComment-442135 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.