Fanatic Posted March 26, 2012 Share Posted March 26, 2012 I get this error: Parse error: syntax error, unexpected T_IF, expecting T_FUNCTION in /home/damdomy/trankia.com/modules/FindPlayer/index.php on line 43 My code is this: <?php //This file cannot be viewed, it must be included defined('IN_EZRPG') or exit; /* Class: Module_FindPlayer Shows a list of members. */ class Module_FindPlayer extends Base_Module { /* Function: start Displays the members list page. */ public function start() { //Require login requireLogin(); if (isset($_GET['username'])) { $username = ($_GET['username']); if (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); // if username, maxlevel and minlevel is set if (isset($_GET['minlevel'])) { echo "find function"; // if username and maxlevel is set } else { echo "find function"; } // if username and minlevel is set } if (isset($GET['minlevel'])) echo "find function"; // if username is set } else { echo "find function"; } } if (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); // if maxlevel and minlevel is set if (isset($_GET['minlevel'])) { $minlevel = ($_GET['minlevel']); echo "find function"; // if maxlevel is set } else { echo "find function"; } // if minlevel is set } if (isset($_GET['minlevel'])) { $minlevel = ($_GET['minlevel']) $query = $this->db->execute('SELECT `username`, `level` FROM `<ezrpg>players` WHERE `level` > ?, ORDER BY `id` ASC LIMIT ?,50', array($minlevel), array($page * 50)); // if nothing is set } else { echo "search page"; } } } function find() { if (isset($_GET['page'])) { $page = (intval($_GET['page']) > 0) ? intval($_GET['page']) : 0; } else { $page = 0; } $members = $this->db->fetchAll($query); $prevpage = (($page - 1) >= 0) ? ($page - 1) : 0; $this->tpl->assign('nextpage', ++$page); $this->tpl->assign('prevpage', $prevpage); $this->tpl->assign('members', $members); $this->tpl->display('findplayer.tpl'); } ?> Anyone got any ideas what is wrong? Quote Link to comment Share on other sites More sharing options...
Uridium Posted March 26, 2012 Share Posted March 26, 2012 dont quote me but try on line 43 } elseif (isset($_GET['maxlevel'])) { Quote Link to comment Share on other sites More sharing options...
Fanatic Posted March 26, 2012 Author Share Posted March 26, 2012 dont quote me but try on line 43 } elseif (isset($_GET['maxlevel'])) { Then I just get this error: Parse error: syntax error, unexpected T_ELSEIF, expecting T_FUNCTION in /home/damdomy/trankia.com/modules/FindPlayer/index.php on line 44 Quote Link to comment Share on other sites More sharing options...
JordanD Posted March 26, 2012 Share Posted March 26, 2012 You have too many }'s there. I think you need to delete the one on line 68, but I'm not sure. Look through the logic in your script and figure out which one isn't needed. Quote Link to comment Share on other sites More sharing options...
Djkanna Posted March 26, 2012 Share Posted March 26, 2012 You have too many }'s there. I think you need to delete the one on line 68, but I'm not sure. Look through the logic in your script and figure out which one isn't needed. Either 68 or 69 will do, but yeah, one to many closing braces. Quote Link to comment Share on other sites More sharing options...
Fanatic Posted March 26, 2012 Author Share Posted March 26, 2012 I got it fixed :D Now I get the following error: Parse error: syntax error, unexpected T_VARIABLE in /home/damdomy/trankia.com/modules/FindPlayer/index.php on line 64 My code is now this: <?php //This file cannot be viewed, it must be included defined('IN_EZRPG') or exit; /* Class: Module_FindPlayer Shows a list of members. */ class Module_FindPlayer extends Base_Module { /* Function: start Displays the members list page. */ public function start() { //Require login requireLogin(); if (isset($_GET['username'])) { $username = ($_GET['username']); if (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); // if username, maxlevel and minlevel is set if (isset($_GET['minlevel'])) { echo "find function"; // if username and maxlevel is set } else { echo "find function"; } } // if username and minlevel is set elseif (isset($GET['minlevel'])) { echo "find function"; } // if username is set else { echo "find function"; } } elseif (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); // if maxlevel and minlevel is set if (isset($_GET['minlevel'])) { $minlevel = ($_GET['minlevel']); echo "find function"; } // if maxlevel is set else { echo "find function"; } } // if minlevel is set if (isset($_GET['minlevel'])) { $minlevel = ($_GET['minlevel']) $query = $this->db->execute('SELECT `username`, `level` FROM `<ezrpg>players` WHERE `level` > ?, ORDER BY `id` ASC LIMIT ?,50', array($minlevel), array($page * 50)); } // if nothing is set else { echo "search page"; } } function find() { if (isset($_GET['page'])) { $page = (intval($_GET['page']) > 0) ? intval($_GET['page']) : 0; } else { $page = 0; } $members = $this->db->fetchAll($query); $prevpage = (($page - 1) >= 0) ? ($page - 1) : 0; $this->tpl->assign('nextpage', ++$page); $this->tpl->assign('prevpage', $prevpage); $this->tpl->assign('members', $members); $this->tpl->display('findplayer.tpl'); } ?> Quote Link to comment Share on other sites More sharing options...
Djkanna Posted March 26, 2012 Share Posted March 26, 2012 63: $minlevel = ($_GET['minlevel']) With $minlevel = ($_GET['minlevel']); Quote Link to comment Share on other sites More sharing options...
Fanatic Posted March 26, 2012 Author Share Posted March 26, 2012 Thanks a lot. Now I just get the following error: Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/damdomy/trankia.com/modules/FindPlayer/index.php on line 91 SOURCE: <?php //This file cannot be viewed, it must be included defined('IN_EZRPG') or exit; /* Class: Module_FindPlayer Shows a list of members. */ class Module_FindPlayer extends Base_Module { /* Function: start Displays the members list page. */ public function start() { //Require login requireLogin(); if (isset($_GET['username'])) { $username = ($_GET['username']); if (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); // if username, maxlevel and minlevel is set if (isset($_GET['minlevel'])) { echo "find function"; // if username and maxlevel is set } else { echo "find function"; } } // if username and minlevel is set elseif (isset($GET['minlevel'])) { echo "find function"; } // if username is set else { echo "find function"; } } elseif (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); // if maxlevel and minlevel is set if (isset($_GET['minlevel'])) { $minlevel = ($_GET['minlevel']); echo "find function"; } // if maxlevel is set else { echo "find function"; } } // if minlevel is set if (isset($_GET['minlevel'])) { $minlevel = ($_GET['minlevel']); $query = $this->db->execute('SELECT `username`, `level` FROM `<ezrpg>players` WHERE `level` > ?, ORDER BY `id` ASC LIMIT ?,50', array($minlevel), array($page * 50)); } // if nothing is set else { echo "search page"; } } function find() { if (isset($_GET['page'])) { $page = (intval($_GET['page']) > 0) ? intval($_GET['page']) : 0; } else { $page = 0; } $members = $this->db->fetchAll($query); $prevpage = (($page - 1) >= 0) ? ($page - 1) : 0; $this->tpl->assign('nextpage', ++$page); $this->tpl->assign('prevpage', $prevpage); $this->tpl->assign('members', $members); $this->tpl->display('findplayer.tpl'); } ?> Quote Link to comment Share on other sites More sharing options...
SilverStar Posted March 26, 2012 Share Posted March 26, 2012 Thanks a lot. Now I just get the following error: Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/damdomy/trankia.com/modules/FindPlayer/index.php on line 91 SOURCE: <?php //This file cannot be viewed, it must be included defined('IN_EZRPG') or exit; /* Class: Module_FindPlayer Shows a list of members. */ class Module_FindPlayer extends Base_Module { /* Function: start Displays the members list page. */ public function start() { //Require login requireLogin(); if (isset($_GET['username'])) { $username = ($_GET['username']); if (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); // if username, maxlevel and minlevel is set if (isset($_GET['minlevel'])) { echo "find function"; // if username and maxlevel is set } else { echo "find function"; } } // if username and minlevel is set elseif (isset($GET['minlevel'])) { echo "find function"; } // if username is set else { echo "find function"; } } elseif (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); // if maxlevel and minlevel is set if (isset($_GET['minlevel'])) { $minlevel = ($_GET['minlevel']); echo "find function"; } // if maxlevel is set else { echo "find function"; } } // if minlevel is set if (isset($_GET['minlevel'])) { $minlevel = ($_GET['minlevel']); $query = $this->db->execute('SELECT `username`, `level` FROM `<ezrpg>players` WHERE `level` > ?, ORDER BY `id` ASC LIMIT ?,50', array($minlevel), array($page * 50)); } // if nothing is set else { echo "search page"; } } function find() { if (isset($_GET['page'])) { $page = (intval($_GET['page']) > 0) ? intval($_GET['page']) : 0; } else { $page = 0; } $members = $this->db->fetchAll($query); $prevpage = (($page - 1) >= 0) ? ($page - 1) : 0; $this->tpl->assign('nextpage', ++$page); $this->tpl->assign('prevpage', $prevpage); $this->tpl->assign('members', $members); $this->tpl->display('findplayer.tpl'); } ?> What more do you need? How about trying to fix errors yourself in order to learn from your mistakes? Quote Link to comment Share on other sites More sharing options...
Lithium Posted March 26, 2012 Share Posted March 26, 2012 A quick look, lines 22-23 you have a missing closing bracket if (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); // if username, maxlevel and minlevel is set Ought to be if (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); } // if username, maxlevel and minlevel is set this is only a guess though... :) Quote Link to comment Share on other sites More sharing options...
Nickson Posted March 26, 2012 Share Posted March 26, 2012 @lithium, that's all fine... @Fanatic You are missing a closing parenthesis }. Depending on where you want to place the function find(), you either need to close the class afterwards (line93) or you still need to close the public function start() (line 71) The issue lies around line 71/93, notice that the closing bracket is positioned to close the class, but if that were the case you're not closing the start() - function. I'm not sure what editor you use, but I suggest you take a new one, preferably one with live debugging (and syntax highlighter of course) while you type out code. Together with keeping a nice structure like you do (and ezRPG has) it's rather easy to spot the issue. My suggestion would be openkomodo/komodo edit (same thing, it just has two names). Quote Link to comment Share on other sites More sharing options...
Fanatic Posted March 26, 2012 Author Share Posted March 26, 2012 A quick look, lines 22-23 you have a missing closing bracket if (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); // if username, maxlevel and minlevel is set Ought to be if (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); } // if username, maxlevel and minlevel is set this is only a guess though... :) Actually it is closing: if (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); // if username, maxlevel and minlevel is set if (isset($_GET['minlevel'])) { echo "find function"; // if username and maxlevel is set } else { echo "find function"; } } Any other ideas? Quote Link to comment Share on other sites More sharing options...
Nickson Posted March 26, 2012 Share Posted March 26, 2012 Have you tried my suggestion fanatic? Quote Link to comment Share on other sites More sharing options...
Fanatic Posted March 26, 2012 Author Share Posted March 26, 2012 (edited) Have you tried my suggestion fanatic? Thanks a lot. I am now using komodoedit, makes it easier to see. I found out where I missed a "{" :D Well, but know I get this error, which I can't find out why: Parse error: syntax error, unexpected T_CLASS in /home/damdomy/trankia.com/modules/FindPlayer/index.php on line 9 Source: <?php //This file cannot be viewed, it must be included defined('IN_EZRPG') or exit; * /* **Class: Module_FindPlayer **Shows a list of members. */ class Module_FindPlayer extends Base_Module { ****/* ******Function: start ******Displays the members list page. *****/ ****public function start() ****{ ********//Require login ********requireLogin(); * ********if (isset($_GET['username'])) { ************$username = ($_GET['username']); ************if (isset($_GET['maxlevel'])) { ****************$maxlevel = ($_GET['maxlevel']); ****************// if username, maxlevel and minlevel is set ****************if (isset($_GET['minlevel'])) { ********************echo "find function"; * ****************// if username and maxlevel is set ****************} ****************else { ********************echo "find function"; ****************} ************} ************* ************// if username and minlevel is set ************elseif (isset($GET['minlevel'])) { ****************echo "find function"; ************} ************* ************// if username is set ************else { ****************echo "find function"; ************} ********} ********* ********elseif (isset($_GET['maxlevel'])) { ************$maxlevel = ($_GET['maxlevel']); * ************// if maxlevel and minlevel is set ************if (isset($_GET['minlevel'])) { ****************$minlevel = ($_GET['minlevel']); ****************echo "find function"; ************} ************* ************// if maxlevel is set ************else { ****************echo "find function"; ************} ********} ********* ********// if minlevel is set ********if (isset($_GET['minlevel'])) { ************$minlevel = ($_GET['minlevel']); ************$query = $this->db->execute('SELECT `username`, `level` FROM `<ezrpg>players` WHERE `level` > ?, * ORDER BY `id` ASC LIMIT ?,50', array($minlevel), array($page * 50)); ********} ********// if nothing is set ********else { ************echo "search page"; ********} } } * function find() { * ****if (isset($_GET['page'])) { ********$page = (intval($_GET['page']) > 0) ? intval($_GET['page']) : 0; ****} ***** ****else { ********$page = 0; ****} * ****$members = $this->db->fetchAll($query); ********* ****$prevpage = (($page - 1) >= 0) ? ($page - 1) : 0; ********* ****$this->tpl->assign('nextpage', ++$page); ****$this->tpl->assign('prevpage', $prevpage); ****$this->tpl->assign('members', $members); ****$this->tpl->display('findplayer.tpl'); } ?> EDIT: For some reason it nows put "*" in where I before had spaces?? It is only when I upload the code here too.?? Edited March 26, 2012 by Fanatic Quote Link to comment Share on other sites More sharing options...
Nickson Posted March 26, 2012 Share Posted March 26, 2012 I have no clue, it just started happening - we're looking at it right now. Quote Link to comment Share on other sites More sharing options...
Nickson Posted March 26, 2012 Share Posted March 26, 2012 test with the latest code fixed ... <?php //This file cannot be viewed, it must be included defined('IN_EZRPG') or exit; /* Class: Module_FindPlayer Shows a list of members. */ class Module_FindPlayer extends Base_Module { /* Function: start Displays the members list page. */ public function start() { //Require login requireLogin(); if (isset($_GET['username'])) { $username = ($_GET['username']); if (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); // if username, maxlevel and minlevel is set if (isset($_GET['minlevel'])) { echo "find function"; // if username and maxlevel is set } else { echo "find function"; } } // if username and minlevel is set elseif (isset($GET['minlevel'])) { echo "find function"; } // if username is set else { echo "find function"; } } elseif (isset($_GET['maxlevel'])) { $maxlevel = ($_GET['maxlevel']); // if maxlevel and minlevel is set if (isset($_GET['minlevel'])) { $minlevel = ($_GET['minlevel']); echo "find function"; } // if maxlevel is set else { echo "find function"; } } // if minlevel is set if (isset($_GET['minlevel'])) { $minlevel = ($_GET['minlevel']); $query = $this->db->execute('SELECT `username`, `level` FROM `<ezrpg>players` WHERE `level` > ?, ORDER BY `id` ASC LIMIT ?,50', array($minlevel), array($page * 50)); } // if nothing is set else { echo "search page"; } } } function find() { if (isset($_GET['page'])) { $page = (intval($_GET['page']) > 0) ? intval($_GET['page']) : 0; } else { $page = 0; } $members = $this->db->fetchAll($query); $prevpage = (($page - 1) >= 0) ? ($page - 1) : 0; $this->tpl->assign('nextpage', ++$page); $this->tpl->assign('prevpage', $prevpage); $this->tpl->assign('members', $members); $this->tpl->display('findplayer.tpl'); } ?> Quote Link to comment Share on other sites More sharing options...
Fanatic Posted March 26, 2012 Author Share Posted March 26, 2012 Thanks Nickson! You are the best! Now I will code the rest :D Hopefully no more errors will come, cause now I am using a better program to code in. Before I was coding in notepad. Quote Link to comment Share on other sites More sharing options...
Nickson Posted March 26, 2012 Share Posted March 26, 2012 I'm still not sure why it's posting the *-characters. There is another post which has the very same issue. I know it's not the editor, as I'm using that one myself and as you can see, it shows the code just fine :/ stange strange, I hope we can fix it soon. You got it working now? Quote Link to comment Share on other sites More sharing options...
Fanatic Posted March 26, 2012 Author Share Posted March 26, 2012 I'm still not sure why it's posting the *-characters. There is another post which has the very same issue. I know it's not the editor, as I'm using that one myself and as you can see, it shows the code just fine :/ stange strange, I hope we can fix it soon. You got it working now? Yea. Thanks a lot. I got it to work :D 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.