onyxblack Posted November 14, 2008 Share Posted November 14, 2008 Parse error: syntax error, unexpected T_ELSEIF in C:\wamp\www\work.php on line 18 My first time i've had to use time though the error is happening before it even gets that far, (will it let me do math like that?) <?php include('incl/login.conf.php'); mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS); mysql_select_db(MYSQL_DB); $ip = mysql_query("select ip FROM timetoclick WHERE ip='".$_SERVER['REMOTE_ADDR']."'"); while($fetchip = mysql_fetch_array( $ip )) $time = mysql_query("select time FROM timetoclick WHERE ip='".$_SERVER['REMOTE_ADDR']."'"); while($fetchtime = mysql_fetch_array( $time )) if ($fetchip['ip'] != $_SERVER['REMOTE_ADDR']); { mysql_query("INSERT INTO timetoclick (time, ip) VALUES ('".time()."', '".$_SERVER['REMOTE_ADDR']."')"); echo "New<br>"; } elseif ($fetchtime['time']-43200>time()); { echo "You have allreact been attacked. You can not be attacked by this person for X"; echo " more seconds."; } else ($fetchtime['time']-43200<time()); { echo "New<br>"; mysql_query("INSERT INTO timetoclick (time, ip) VALUES ('".time()."', '".$_SERVER['REMOTE_ADDR']."')"); } ?> Link to comment https://forums.phpfreaks.com/topic/132653-solved-parse-error-syntax-error-unexpected-t_elseif/ Share on other sites More sharing options...
DarkWater Posted November 14, 2008 Share Posted November 14, 2008 You have a semicolon after the if and elseif and else. Remove those. Link to comment https://forums.phpfreaks.com/topic/132653-solved-parse-error-syntax-error-unexpected-t_elseif/#findComment-689898 Share on other sites More sharing options...
onyxblack Posted November 14, 2008 Author Share Posted November 14, 2008 heh, well still a noob at this... Ok, so after removing those I'm getting, Parse error: syntax error, unexpected '{' in C:\wamp\www\work.php on line 24 And after removing the '{' I'm getting, Parse error: syntax error, unexpected T_STRING in C:\wamp\www\work.php on line 25 >.< Link to comment https://forums.phpfreaks.com/topic/132653-solved-parse-error-syntax-error-unexpected-t_elseif/#findComment-689899 Share on other sites More sharing options...
DarkWater Posted November 14, 2008 Share Posted November 14, 2008 Didn't even notice that. Else blocks are not allowed to have any conditions. Put the { back and remove the stuff in ( ) after else. Link to comment https://forums.phpfreaks.com/topic/132653-solved-parse-error-syntax-error-unexpected-t_elseif/#findComment-689900 Share on other sites More sharing options...
onyxblack Posted November 14, 2008 Author Share Posted November 14, 2008 Thanks a bunch man, now im getting a SQL syntax error, but i should be able to fix that on my own. Thank you! Link to comment https://forums.phpfreaks.com/topic/132653-solved-parse-error-syntax-error-unexpected-t_elseif/#findComment-689901 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.