...

View Full Version : Variable tells me it is not defined



golffor1
07-22-2012, 05:58 AM
I get the following error messages:

( ! ) Notice: Undefined variable: insertNPlayer in C:\wamp\www\new_signup_test.php on line 196
Call Stack
# Time Memory Function Location
1 0.0020 448048 {main}( ) ..\new_signup_test.php:0

( ! ) Fatal error: Function name must be a string in C:\wamp\www\new_signup_test.php on line 196
Call Stack
# Time Memory Function Location
1 0.0020 448048 {main}( ) ..\new_signup_test.php:0

Here is the code around line 195 and 196


$insertNewPlayer = "INSERT INTO security (player_number, new_player_number, userid, password, userlevel, replace_password) VALUES ('$newPlayerNumber', 0, '$newUserNameWithNumber', '$password', 1, 1)";

$insertNPlayer($insertNewPlayer, $link) or die ("Please contact me@me.org Error inserting new player one: " .mysql_error());


When I view $insertNewPlayer it shows up correctly. Those two errors are confusing me.

Len Whistler
07-22-2012, 06:07 AM
Notice: Undefined variable: insertNPlayer means that $insertNPlayer is not set. So it needs a default value, the simple change below should solve the undefined error - assuming the line below is correct.


$insertNPlayer = "test";
$insertNPlayer($insertNewPlayer, $link) or die ("Please contact me@me.org Error inserting new player one: " .mysql_error());

Fou-Lu
07-22-2012, 06:15 PM
Where is $insertNPlayer defined? Its not in your code here, which definitely corresponds to the errors.
It has to be a string representing a function that accepts a string and (presumably) a resource, or of a closure type accepting the same parameters.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum