Fanatic Posted March 31, 2012 Share Posted March 31, 2012 Does anyone have any ideas why I get those errors: Notice: Undefined variable: minlevel in /home/damdomy/trankia.com/modules/FindPlayer/index.php on line 94 Warning: array_fill() [function.array-fill]: Wrong data type for start key in /home/damdomy/trankia.com/lib/db.mysql.php on line 133 ezRPG Error: DbException! Query: SELECT username, level FROM players WHERE level > ?,50 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?,50' at line 3 Source code: http://pastebin.com/eMg4mRwG Quote Link to comment Share on other sites More sharing options...
Danny696 Posted March 31, 2012 Share Posted March 31, 2012 $minlevel doesnt exist, or its not global'd in the function/arguments Quote Link to comment Share on other sites More sharing options...
Fanatic Posted March 31, 2012 Author Share Posted March 31, 2012 $minlevel doesnt exist, or its not global'd in the function/arguments How do I make it global? Quote Link to comment Share on other sites More sharing options...
Danny696 Posted March 31, 2012 Share Posted March 31, 2012 Looking at your code, it looks like its $_GET['minlevel'] Quote Link to comment Share on other sites More sharing options...
Fanatic Posted March 31, 2012 Author Share Posted March 31, 2012 Looking at your code, it looks like its $_GET['minlevel'] It is in line 95. But should I put this somewhere else? like in the start of the script? BTW: Are you the owner of w3theory? Quote Link to comment Share on other sites More sharing options...
Danny696 Posted March 31, 2012 Share Posted March 31, 2012 1. Well, Its in another function, so isnt globally accessible. 2. No, its an affiliate link. Quote Link to comment Share on other sites More sharing options...
sniko Posted March 31, 2012 Share Posted March 31, 2012 Fanatic Try something along these lines... When you declare the function start() add a parameter, for example $min_level /* * Add a parameter * Add a value, so when called, and no parameter is given it won't show ugly errors * Default, minimum level 1. */ public function start($min_level = 1) Now, Line 82. /* * Use the parameter declared in the function declaration * $min_level */ $minlevel = $min_level; ! Use the above to help configure the rest of the php. Now, when you call this function start(), add the parameter /* * Assign the class, I assume that's been done. * I'll call it $class */ $minlevel = $var; // assume _GET['minlevel'] $class->start($minlevel); /* Declare a minimum level. Overwrite the default; 1. */ I think this should fix your error, it may not, but it might. Quote Link to comment Share on other sites More sharing options...
Danny696 Posted March 31, 2012 Share Posted March 31, 2012 Now, Line 82. /* * Use the parameter declared in the function declaration * $min_level */ $minlevel = $min_level; Baffles me why you would do that. Quote Link to comment Share on other sites More sharing options...
sniko Posted March 31, 2012 Share Posted March 31, 2012 Baffles me why you would do that. Yeah, thinking back, it's ridiculous... Wasting memory... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.