Jump to content

Recommended Posts

Hello PHP Freaks :P 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

Link to comment
https://forums.phpfreaks.com/topic/86464-syntax-error-need-help/
Share on other sites

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.

 

no that didnt work :P i will try to explain more :P

 

	  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 :P 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?

<?
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"

 

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

 

 

:o

<?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";}
?>

<?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 :( :/

I dont understand how my example above didn't work?

 

yay it worked now :P 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";}
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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