Jump to content

Unexpected T_VARIABLE driving me crazy


Thomisback

Recommended Posts

Since my other topics got a bit messy I have started a new one,

 

I am one step further but I get the following error:

 

Parse error: syntax error, unexpected T_VARIABLE in  etc. etc.

 

I searched these forums and half the www for an answer but without luck, I hope someone can help me out!

 

mysql_query("INSERT INTO $weapons VALUES (1, 'Mes', 1, 2000, 'item-Knife', 20, 20, '1 per $type_s (Je hebt $num $type_p die dit wapen nog niet hebben)', "$num = $data->clicks-$data->Mes; return $num;", 'Al je $type_p hebben al een mes', NULL)");

mysql_query("INSERT INTO $weapons VALUES (2, 'Walter P99', 1, 5000, 'item-Walter_P99', 50, 50, '1 per $type_s (Je hebt $num $type_p die dit wapen nog niet hebben)', $num = $data->clicks-$data->{''Walter P99''}; return $num;', 'Al je $type_p hebben al een Walter P99', NULL)");

mysql_query("INSERT INTO $weapons VALUES (3, 'Uzi', 1, 6000, 'item-Uzi', 65, 65, '1 per $type_s (Je hebt $num $type_p die dit wapen nog niet hebben)', '$num = $data->clicks-$data->Uzi; return $num;', 'Al je $type_p hebben al een uzi', NULL)");

mysql_query("INSERT INTO $weapons VALUES (4, 'Flashbang', 1, 10000, 'item-Flashbang', 110, 110, '1 per $type_s (Je hebt $num $type_p die deze granaat nog niet hebben)', '$num = $data->clicks-$data->Flashbang; return $num;', 'Al je $type_p hebben al een flashbang', NULL)");

mysql_query("INSERT INTO $weapons VALUES (5, 'Granaat', 1, 15000, 'item-Grenade', 170, 170, '1 per $type_s (Je hebt $num $type_p die deze granaat nog niet hebben)', '$num = $data->clicks-$data->Granaat; return $num;', 'Al je $type_p hebben al een granaat', NULL)");

mysql_query("INSERT INTO $weapons VALUES (6, 'MP5k', 1, 7500, 'item-MP5k', 80, 80, 'Je hebt $num $type_p die dit wapen kunnen dragen', '$num = $data->clicks-$data->MP5k-$data->Shotgun-$data->G36C-$data->{''SIG 552''}-$data->Ak47-$data->{''Ak Beta''}-$data->{''Scherpschut geweer''}-$data->M4-$data->{''Granaat Lanceerder''}-$data->Bazooka; return $num;', 'Je hebt geen $type_s die dit wapen kan dragen', NULL)");

mysql_query("INSERT INTO $weapons VALUES (7, 'Shotgun', 1, 17500, 'item-Shotgun', 200, 200, 'Je hebt $num $type_p die dit wapen kunnen dragen', '$num = $data->clicks-$data->MP5k-$data->Shotgun-$data->G36C-$data->{''SIG 552''}-$data->Ak47-$data->{''Ak Beta''}-$data->{''Scherpschut geweer''}-$data->M4-$data->{''Granaat Lanceerder''}-$data->Bazooka; return $num;', 'Je hebt geen $type_s die dit wapen kan dragen', NULL)");

mysql_query("INSERT INTO $weapons VALUES (8, 'G36C', 1, 22500, 'item-G36C', 270, 270, 'Je hebt $num $type_p die dit wapen kunnen dragen', '$num = $data->clicks-$data->MP5k-$data->Shotgun-$data->G36C-$data->{''SIG 552''}-$data->Ak47-$data->{''Ak Beta''}-$data->{''Scherpschut geweer''}-$data->M4-$data->{''Granaat Lanceerder''}-$data->Bazooka; return $num;', 'Je hebt geen $type_s die dit wapen kan dragen', NULL)");

mysql_query("INSERT INTO $weapons VALUES (9, 'SIG 552', 1, 25000, 'item-SIG_552', 310, 310, 'Je hebt $num $type_p die dit wapen kunnen dragen', '$num = $data->clicks-$data->MP5k-$data->Shotgun-$data->G36C-$data->{''SIG 552''}-$data->Ak47-$data->{''Ak Beta''}-$data->{''Scherpschut geweer''}-$data->M4-$data->{''Granaat Lanceerder''}-$data->Bazooka; return $num;', 'Je hebt geen $type_s die dit wapen kan dragen', NULL)");

mysql_query("INSERT INTO $weapons VALUES (10, 'Ak47', 1, 30000, 'item-Ak47', 390, 390, 'Je hebt $num $type_p die dit wapen kunnen dragen', '$num = $data->clicks-$data->MP5k-$data->Shotgun-$data->G36C-$data->{''SIG 552''}-$data->Ak47-$data->{''Ak Beta''}-$data->{''Scherpschut geweer''}-$data->M4-$data->{''Granaat Lanceerder''}-$data->Bazooka; return $num;', 'Je hebt geen $type_s die dit wapen kan dragen', NULL)");

mysql_query("INSERT INTO $weapons VALUES (11, 'Ak Beta', 1, 40000, 'item-Ak_Beta', 570, 570, 'Je hebt $num $type_p die dit wapen kunnen dragen', '$num = $data->clicks-$data->MP5k-$data->Shotgun-$data->G36C-$data->{''SIG 552''}-$data->Ak47-$data->{''Ak Beta''}-$data->{''Scherpschut geweer''}-$data->M4-$data->{''Granaat Lanceerder''}-$data->Bazooka; return $num;', 'Je hebt geen $type_s die dit wapen kan dragen', NULL)");

mysql_query("INSERT INTO $weapons VALUES (12, 'Scherpschut geweer', 1, 45000, 'item-Sniper_rifle', 670, 670, 'Je hebt $num $type_p die dit wapen kunnen dragen', '$num = $data->clicks-$data->MP5k-$data->Shotgun-$data->G36C-$data->{''SIG 552''}-$data->Ak47-$data->{''Ak Beta''}-$data->{''Scherpschut geweer''}-$data->M4-$data->{''Granaat Lanceerder''}-$data->Bazooka; return $num;', 'Je hebt geen $type_s die dit wapen kan dragen', NULL)");

mysql_query("INSERT INTO $weapons VALUES (13, 'M4', 1, 50000, 'item-M4', 780, 780, 'Je hebt $num $type_p die dit wapen kunnen dragen', '$num = $data->clicks-$data->MP5k-$data->Shotgun-$data->G36C-$data->{''SIG 552''}-$data->Ak47-$data->{''Ak Beta''}-$data->{''Scherpschut geweer''}-$data->M4-$data->{''Granaat Lanceerder''}-$data->Bazooka; return $num;', 'Je hebt geen $type_s die dit wapen kan dragen', NULL)");

mysql_query("INSERT INTO $weapons VALUES (14, 'Granaat Lanceerder', 1, 60000, 'item-Grenade_Launcher', 1030, 1030, 'Je hebt $num $type_p die dit wapen kunnen dragen', '$num = $data->clicks-$data->MP5k-$data->Shotgun-$data->G36C-$data->{''SIG 552''}-$data->Ak47-$data->{''Ak Beta''}-$data->{''Scherpschut geweer''}-$data->M4-$data->{''Granaat Lanceerder''}-$data->Bazooka; return $num;', 'Je hebt geen $type_s die dit wapen kan dragen', NULL)");

mysql_query("INSERT INTO $weapons VALUES (15, 'Bazooka', 1, 75000, 'item-Bazooka', 1490, 1490, 'Je hebt $num $type_p die dit wapen kunnen dragen', '$num = $data->clicks-$data->MP5k-$data->Shotgun-$data->G36C-$data->{''SIG 552''}-$data->Ak47-$data->{''Ak Beta''}-$data->{''Scherpschut geweer''}-$data->M4-$data->{''Granaat Lanceerder''}-$data->Bazooka; return $num;', 'Je hebt geen $type_s die dit wapen kan dragen', NULL)");

mysql_query("INSERT INTO $weapons VALUES (16, 'Kogelvrij vest', 2, 12500, 'item-Bulletproof_vest', 140, 140, '1 per $type_s (Je hebt $num $type_p die dit vest nog niet hebben)', '$num = $data->clicks-$data->{''Kogelvrij vest''}; return $num;', 'Je hebt geen $type_s die dit vest kan dragen', NULL");

mysql_query("INSERT INTO $weapons VALUES (17, 'Bulldog', 3, 2500, 'item-Bulldog', 0, 30, '5 (Je kan nog $num honden meer hebben)', '$num = 5-$data->Bulldog; return $num;', 'Je hebt al 5 honden', NULL)");

mysql_query("INSERT INTO $weapons VALUES (18, 'Camera', 3, 8000, 'item-Cam', 0, 90, '7 (Je kan nog $num cameras plaatsen)', '$num = 7-$data->Camera; return $num;', 'Je hebt al 7 cameras', NULL)");

mysql_query("INSERT INTO $weapons VALUES (19, 'Hek', 3, 15000, 'item-Barbed_wire', 0, 170, '3 (Je kan nog $num hekken neerzetten)', '$num = 3-$data->Hek; return $num;', 'Je hebt al 3 hekken', NULL)");

mysql_query("INSERT INTO $weapons VALUES (20, 'Muur', 3, 20000, 'item-Stone_wall', 0, 240, '3 (Je kan nog $num muren bouwen)', '$num = 3-$data->Muur; return $num;', 'Je hebt al 3 muren', NULL)");

mysql_query("INSERT INTO $weapons VALUES (21, 'Bunker', 3, 35000, 'item-Bunker', 0, 470, '5 (Je kan nog $num bunkers bouwen)', '$num = 5-$data->Bunker; return $num;', 'Je hebt al 5 bunkers', NULL)");

mysql_query("INSERT INTO $weapons VALUES (22, 'Mobieltje', 4, 1000, 'item-Cellphone', NULL, NULL, '1 (Je kan nog $num mobieltjes kopen)', '$num = 1-$data->Mobieltje; return $num;', 'Je hebt al een mobieltje', 'Als je een mobiel hebt kun je berichten versturen en ontvangen')");

mysql_query("INSERT INTO $weapons VALUES (23, 'FN P90', 5, 50000, 'item-FN_P90', 900, 900, '1 per junkie (Je hebt nog $num junkies die dit wapen kunnen dragen)', '$num = $data->clicks-$data->{''FN P90''}; return $num;', 'Al je junkies hebben dit wapen al', NULL)");

mysql_query("INSERT INTO $weapons VALUES (24, 'Chip', 6, 25000, 'item-Chip', 400, 400, '1 per kloon (Je hebt $num klonen die nog geen chip hebben)', '$num = $data->clicks-$data->Chip; return $num;', 'Al je klonen hebben al een chip in hun hoofd', NULL)");

mysql_query("INSERT INTO $weapons VALUES (25, 'Helm', 7, 20000, 'item-Helmet', 240, 240, '1 per agent (Je hebt nog $num agenten zonder helm)', '$num = $data->clicks-$data->Helm; return $num;', 'Elke agent heeft al een helm', NULL)");

mysql_query("INSERT INTO $weapons VALUES (26, 'Politie wagen', 7, 35000, 'item-Police_car', 470, 470, '1 per agent (Je kan nog $num wagens kopen)', '$num = $data->clicks-$data->{''Politie wagen''}; return $num;', 'Elke agent heeft al een wagen', NULL)");

mysql_query("INSERT INTO $weapons VALUES (27, 'Huis', 8, 25000, 'item-Home', NULL, NULL, '100m<sup>2</sup> (Je hebt nog ${num}m<sup>2</sup>)', '$num = $clan->land-($clan->homes*100+$clan->money_lvl2*150+$clan->money_lvl3*200+$clan->def_lvl1*25+$clan->def_lvl2*100+$clan->def_lvl3*150); $num -= ($clan->type == 3) ? 0 : $clan->money_lvl1*100; return ($num >= 100) ? 1 : 0;', 'Je hebt niet genoeg land om een huis te bouwen', 'In ieder huis kunnen 5 clan-members')");

mysql_query("INSERT INTO $weapons VALUES (28, 'Muur', 8, 50000, 'item-Stone_wall', NULL, 3000, '100m<sup>2</sup> (Je hebt nog ${num}m<sup>2</sup>)', '$num = $clan->land-($clan->homes*100+$clan->money_lvl2*150+$clan->money_lvl3*200+$clan->def_lvl1*25+$clan->def_lvl2*100+$clan->def_lvl3*150); $num -= ($clan->type == 3) ? 0 : $clan->money_lvl1*100; return ($num >= 100) ? 1 : 0;', 'Je hebt niet genoeg land om een muur te bouwen', NULL)");

mysql_query("INSERT INTO $weapons VALUES (29, 'Coffeeshop', 9, 90000, 'item-Joint', NULL, NULL, '100m<sup>2</sup> (Je hebt nog ${num}m<sup>2</sup>)', '$num = $clan->land-($clan->homes*100+$clan->money_lvl1*100+$clan->money_lvl2*150+$clan->money_lvl3*200+$clan->def_lvl1*25+$clan->def_lvl2*100+$clan->def_lvl3*150); return ($num >= 100) ? 1 : 0;', 'Je hebt niet genoeg land om een coffeeshop te bouwen', 'Met een coffeeshop verdient elke clan-member per uur:<br>Bank: $150,contant: $50')");

mysql_query("INSERT INTO $weapons VALUES (30, 'Chemie Lab', 10, 90000, 'item-Alchemy', NULL, NULL, '100m<sup>2</sup> (Je hebt nog ${num}m<sup>2</sup>)', '$num = $clan->land-($clan->homes*100+$clan->money_lvl1*100+$clan->money_lvl2*150+$clan->money_lvl3*200+$clan->def_lvl1*25+$clan->def_lvl2*100+$clan->def_lvl3*150); return ($num >= 100) ? 1 : 0;', 'Je hebt niet genoeg land om een lab te bouwen', 'Met een chemie lab verdient elke clan-member per uur:<br>Bank: $100,contant: $100')");

mysql_query("INSERT INTO $users (`id`, `signup`, `login`, `pass`, `level`, `IP`, `email`, `type`, `url`, `info`, `cash`, `bank`, `bankleft`, `bankmax`, `clicks`, `clickstoday`, `attack`, `defence`, `attwins`, `attlosses`, `defwins`, `deflosses`, `clan`, `clanlevel`, `bonus`, `turns`, `showonline`, `online`, `activated`, `Mes`, `Walter P99`, `Uzi`, `MP5k`, `Flashbang`, `Granaat`, `Shotgun`, `G36C`, `SIG 552`, `Ak47`, `Ak Beta`, `Scherpschut geweer`, `M4`, `Granaat Lanceerder`, `Bazooka`, `Kogelvrij vest`, `Bulldog`, `Camera`, `Hek`, `Muur`, `Bunker`, `Mobieltje`, `FN P90`, `Chip`, `Helm`, `Politie wagen`, `IPs`, `blocklist`) VALUES 
(1, '2008-02-29 21:06:02', '$usr', '$password', 255, '0.0.0.0', '$email', 1, '', '', 500, 500, 5, 2500, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, '', 100, 1, '2008-02-29 21:09:17', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '')");

 

On my localhost it works fine but on my remote server I get an error!

 

Thanks!

Link to comment
Share on other sites

You should get a line number where the error message is.

 

Look at that line number and the lines before and after it.

 

Unexpected tvalue is many times a missing dollar sign ($)

 

Also check for missing semi colons.

Link to comment
Share on other sites

You should get a line number where the error message is.

 

Look at that line number and the lines before and after it.

 

Unexpected tvalue is many times a missing dollar sign ($)

 

Also check for missing semi colons.

Thanks, yes the first line of the code I showed is the line with the error in it, although I think all the other lines must have errors in them as well. I think that the problem is that it tried to take the value of some variables but I want to use them as a string...

Link to comment
Share on other sites

Unwexpected T_Variable means either an Added $ dollar symbol or incorrect syntax before the $ dollar symbol.

 

ok your queries look really complicated to me, looks like a huge amount of syntax errors, but you say it worked on your local server so anyway, i dont get this part:

 

$num = $data->clicks-$data->Mes; return $num;

 

i believe the first query is the one giving the error

 

mysql_query("INSERT INTO $weapons VALUES (1, 'Mes', 1, 2000, 'item-Knife', 20, 20, '1 per $type_s (Je hebt $num $type_p die dit wapen nog niet hebben)', "$num = $data->clicks-$data->Mes; return $num;", 'Al je $type_p hebben al een mes', NULL)");

 

 

try:

 

mysql_query("INSERT INTO $weapons VALUES (1, 'Mes', 1, 2000, 'item-Knife', 20, 20, '1 per $type_s (Je hebt $num $type_p die dit wapen nog niet hebben)', '$num = $data->clicks-$data->Mes; return $num;', 'Al je $type_p hebben al een mes', NULL)");

 

 

im guessing your using classes, i cannot believe this is working on ur local server, or am i being syntax-paranoid?

 

 

hope this helps,

Link to comment
Share on other sites

Unwexpected T_Variable means either an Added $ dollar symbol or incorrect syntax before the $ dollar symbol.

 

ok your queries look really complicated to me, looks like a huge amount of syntax errors, but you say it worked on your local server so anyway, i dont get this part:

 

$num = $data->clicks-$data->Mes; return $num;

 

i believe the first query is the one giving the error

 

mysql_query("INSERT INTO $weapons VALUES (1, 'Mes', 1, 2000, 'item-Knife', 20, 20, '1 per $type_s (Je hebt $num $type_p die dit wapen nog niet hebben)', "$num = $data->clicks-$data->Mes; return $num;", 'Al je $type_p hebben al een mes', NULL)");

 

 

try:

 

mysql_query("INSERT INTO $weapons VALUES (1, 'Mes', 1, 2000, 'item-Knife', 20, 20, '1 per $type_s (Je hebt $num $type_p die dit wapen nog niet hebben)', '$num = $data->clicks-$data->Mes; return $num;', 'Al je $type_p hebben al een mes', NULL)");

 

 

im guessing your using classes, i cannot believe this is working on ur local server, or am i being syntax-paranoid?

 

 

hope this helps,

 

Your my master, that worked like a charm! I will try to change all the others like you just did! Thank you very much for helping me out!

 

And i don't know why it did work on my localhost lol, I am using the XAMPP package... maybe that helps...

Link to comment
Share on other sites

np, just a thought though:

 

try this:

 

<?php 

function dothequery($queries){
if(is_array($queries)){
	foreach($queries As $Query){
		$res = mysql_query($Query) or Die("Error: ".$Query."<br />".mysql_error());
	}
}else{
	$res = mysql_query($queries) or Die("Error: ".$queries."<br />".mysql_error());
}
return $res;
}

$Queries = Array(
"INSERT INTO $weapons VALUES (1, 'Mes', 1, 2000, 'item-Knife', 20, 20, '1 per $type_s (Je hebt $num $type_p die dit wapen nog niet hebben)', '$num = $data->clicks-$data->Mes; return $num;', 'Al je $type_p hebben al een mes', NULL)",
"INSERT INTO $weapons VALUES (2, 'Walter P99', 1, 5000, 'item-Walter_P99', 50, 50, '1 per $type_s (Je hebt $num $type_p die dit wapen nog niet hebben)', '$num = $data->clicks-$data->{''Walter P99''}; return $num;', 'Al je $type_p hebben al een Walter P99', NULL)",
"INSERT INTO $weapons VALUES (3, 'Uzi', 1, 6000, 'item-Uzi', 65, 65, '1 per $type_s (Je hebt $num $type_p die dit wapen nog niet hebben)', '$num = $data->clicks-$data->Uzi; return $num;', 'Al je $type_p hebben al een uzi', NULL)",
"INSERT INTO $weapons VALUES (4, 'Flashbang', 1, 10000, 'item-Flashbang', 110, 110, '1 per $type_s (Je hebt $num $type_p die deze granaat nog niet hebben)', '$num = $data->clicks-$data->Flashbang; return $num;', 'Al je $type_p hebben al een flashbang', NULL)",
"INSERT INTO $weapons VALUES (5, 'Granaat', 1, 15000, 'item-Grenade', 170, 170, '1 per $type_s (Je hebt $num $type_p die deze granaat nog niet hebben)', '$num = $data->clicks-$data->Granaat; return $num;', 'Al je $type_p hebben al een granaat', NULL)",
"INSERT INTO $weapons VALUES (6, 'MP5k', 1, 7500, 'item-MP5k', 80, 80, 'Je hebt $num $type_p die dit wapen kunnen dragen', '$num = $data->clicks-$data->MP5k-$data->Shotgun-$data->G36C-$data->{''SIG 552''}-$data->Ak47-$data->{''Ak Beta''}-$data->{''Scherpschut geweer''}-$data->M4-$data->{''Granaat Lanceerder''}-$data->Bazooka; return $num;', 'Je hebt geen $type_s die dit wapen kan dragen', NULL)",
"INSERT INTO $weapons VALUES (7, 'Shotgun', 1, 17500, 'item-Shotgun', 200, 200, 'Je hebt $num $type_p die dit wapen kunnen dragen', '$num = $data->clicks-$data->MP5k-$data->Shotgun-$data->G36C-$data->{''SIG 552''}-$data->Ak47-$data->{''Ak Beta''}-$data->{''Scherpschut geweer''}-$data->M4-$data->{''Granaat Lanceerder''}-$data->Bazooka; return $num;', 'Je hebt geen $type_s die dit wapen kan dragen', NULL)",
"INSERT INTO $weapons VALUES (8, 'G36C', 1, 22500, 'item-G36C', 270, 270, 'Je hebt $num $type_p die dit wapen kunnen dragen', '$num = $data->clicks-$data->MP5k-$data->Shotgun-$data->G36C-$data->{''SIG 552''}-$data->Ak47-$data->{''Ak Beta''}-$data->{''Scherpschut geweer''}-$data->M4-$data->{''Granaat Lanceerder''}-$data->Bazooka; return $num;', 'Je hebt geen $type_s die dit wapen kan dragen', NULL)"
);
// add the rest of your queries like above

$Result = dothequery($Queries);

?>

 

also note in your queries be careful to make sure you "escape" specific characters unwanted inside the value fields, like single quotes.

 

to make it a little easier, ass each value your putting into the db as a variable before hand, so instead of:

 

$query = "INSERT INTO $table VALUES ('blah blah','$blah2 and blah2')"

 

you would use:

 

$val1 = "blah blah";
$val2 = $blah2." and blah2";
$query = "INSERT INTO $table VALUES ('$val1','$val2')";

 

you will be able to use mysql_escape_string which will secure your query values to work:

 

$val1 = "blah blah";
$val2 = $blah2." and blah2";
$query = "INSERT INTO $table VALUES ('".mysql_escape_string($val1)."','".mysql_escape_string($val2)."')";

 

 

hope this helps,

Link to comment
Share on other sites

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.