Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

syntax error somewhere...

Status
Not open for further replies.

theoneweasel77

Programmer
Aug 10, 2004
54
0
0
US
can someone look at this function and tell me what's wrong? I'm getting the following error:
Parse error: parse error, unexpected T_VARIABLE in (file name) on line 13
Code:
function store_data($db, $ID, $color, $moves)
	{
		for($i = 1, $foo = 0; $i <= 12; $i++, $foo += 2)
		{
			$foo2 = $foo + 1;
			$move_from = "move".$i."from";
			$move_to = "move".$i."to";
			$piece_update = mysql_query("UPDATE `moves` SET `$move_from` = '$moves[$foo]', `$move_to` = '$moves[$foo2]' WHERE `ID` = '$ID' && `color` = '$color'", $db);
			print mysql_error();
/* line 13 */		print_r $moves;
			print $moves[$foo];
		}
	}
 
I don't know why you need parenthesis there... that seems odd to me. oh well.
 
Actually, what I don't know is why you don't need paranthesis for print (obviously). After all, it's a function, as far as I can see. Anybody got pointers on that?

haslo@haslo.ch - www.haslo.ch​
 
print isn't a function, its a language construct which means it doesn't need paranthesis. However, print_r is a function (I think) and so would need paranthesis.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top