Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2008
    Posts
    39
    Thanks
    0
    Thanked 1 Time in 1 Post

    Variable tells me it is not defined

    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
    Code:
    $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.

  • #2
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    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.

    PHP Code:
    $insertNPlayer "test";
    $insertNPlayer($insertNewPlayer$link) or die ("Please contact me@me.org Error inserting new player one: " .mysql_error()); 
    Last edited by Len Whistler; 07-22-2012 at 05:11 AM.
    Leonard Whistler

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •