Fabis94 Posted July 9, 2009 Share Posted July 9, 2009 This is really frustrating. This is my code: <?php //Forum List Legends v1.0 by Fabis $expired1 = file_get_contents('expired.txt'); $expired = explode(";", $expired1); //$expired[0] is the prefix, $expired[1] is the suffix $suspended1 = file_get_contents('suspended.txt'); $suspended = explode(";", $suspended1); //$suspended[0] is the prefix, $suspended[1] is the suffix function makeFull($str, $pre, $suf) { $full = $pre . $str . $suf; return $full; } function legendUse($output ,$name, $pd) { //$expired1 = file_get_contents('expired.txt'); //$expired = explode(";", $expired1); //$expired[0] is the prefix, $expired[1] is the suffix //$suspended1 = file_get_contents('suspended.txt'); //$suspended = explode(";", $suspended1); //$suspended[0] is the prefix, $suspended[1] is the suffix $full = $output; if (needPrune($name, $pd) == TRUE) { return makeFull($output, $expired[0], $expired[1]); } else if (isSuspended($name) == TRUE) { return makeFull($output, $suspended[0], $suspended[1]); } return $full; } function isSuspended($accessn) { $query1 = "SELECT * FROM suspended_forums WHERE fname='" . $accessn . "'"; $query = mysql_query($query1); return (mysql_num_rows($query) != 0); } function needPrune($access, $prunedate) { //Must be YYYY-MM-DD $table = $access . '_isawaiting_activation'; if (!mysql_is_tableN($table)) { //Doesnt need activation thus false echo '!FIRST FALSE!'; return FALSE; } $get_info = "SELECT * FROM hosted_forums WHERE fname='" . $access . "'"; $info = mysql_query($get_info); if (mysql_num_rows($info) != 1) { die("Cannot find the name? Weird..."); } $nameinfo = mysql_fetch_assoc($info); $regdate1 = $nameinfo['regdate']; $todayd = date("Y-m-d"); $today = strtotime($todayd); $regdate = strtotime($regdate1); $autoprune = $prunedate * 86400; $expire = $regdate + $autoprune; if ($today > $expire) { echo '!TRUE!'; return TRUE; } echo '!LAST FALSE!'; return FALSE; } function mysql_is_tableN($tbl) { $tables = array(); $q = @mysql_query("SHOW TABLES"); while ($r = @mysql_fetch_array($q)) { $tables[] = $r[0]; } @mysql_free_result($q); if (in_array($tbl, $tables)) { return TRUE; } else { return FALSE; } } ?> When i run it i get Parse error: syntax error, unexpected T_ELSE in /home/mechtop1/public_html//color.conf.php on line 19 Link to comment https://forums.phpfreaks.com/topic/165380-unexpected-t_else/ Share on other sites More sharing options...
thebadbad Posted July 9, 2009 Share Posted July 9, 2009 I don't get the error when executing the code. Try to use elseif (one word) instead of else if, although it shouldn't make a difference. Link to comment https://forums.phpfreaks.com/topic/165380-unexpected-t_else/#findComment-872211 Share on other sites More sharing options...
jsschmitt Posted July 9, 2009 Share Posted July 9, 2009 Make your "else if" into "elseif"... Link to comment https://forums.phpfreaks.com/topic/165380-unexpected-t_else/#findComment-872212 Share on other sites More sharing options...
Maq Posted July 9, 2009 Share Posted July 9, 2009 I don't get the error when executing the code. Try to use elseif (one word) instead of else if, although it shouldn't make a difference. It doesn't: Note: Note that elseif and else if will only be considered exactly the same when using curly brackets as in the above example. When using a colon to define your if/elseif conditions, you must not separate else if into two words, or PHP will fail with a parse error. I'm not seeing the error nor do I receive and error. Are you sure you posted the correct code? Link to comment https://forums.phpfreaks.com/topic/165380-unexpected-t_else/#findComment-872222 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.