Lamez Posted April 16, 2010 Share Posted April 16, 2010 Hey guys, for whatever reason I am getting this syntax error: Parse error: syntax error, unexpected '(', expecting ')' in C:\wamp\www\core\functions.php on line 229 here is line 229: <?php function addError($error, $ip = getIp(), $date = currentDate(), $time = currentTime()){ ?> Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/198772-i-cannot-see-the-error-simple-fix/ Share on other sites More sharing options...
Ken2k7 Posted April 16, 2010 Share Posted April 16, 2010 You can't specify a default value to a function call. Quote Link to comment https://forums.phpfreaks.com/topic/198772-i-cannot-see-the-error-simple-fix/#findComment-1043208 Share on other sites More sharing options...
Lamez Posted April 16, 2010 Author Share Posted April 16, 2010 Thanks, I had a feeling that is what it was. Quote Link to comment https://forums.phpfreaks.com/topic/198772-i-cannot-see-the-error-simple-fix/#findComment-1043209 Share on other sites More sharing options...
Lamez Posted April 16, 2010 Author Share Posted April 16, 2010 okay I did something like this in my function definition. Would this be considered "proper" <?php function addErrorLog($error, $ip = NULL, $date = NULL, $time = NULL){ if($ip == NULL) $ip = getIp(); if($date == NULL) $date = currentDate(); if($time == NULL) $time == currentTime(); mysql_query("INSERT INTO ".TBL_ERROR_LOG." (ip_address, time, date, error) VALUES ('$ip', '$time', '$date', '$error')"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/198772-i-cannot-see-the-error-simple-fix/#findComment-1043213 Share on other sites More sharing options...
Ken2k7 Posted April 16, 2010 Share Posted April 16, 2010 Read is_null And I would do some validation on IP etc. Quote Link to comment https://forums.phpfreaks.com/topic/198772-i-cannot-see-the-error-simple-fix/#findComment-1043214 Share on other sites More sharing options...
Lamez Posted April 16, 2010 Author Share Posted April 16, 2010 well this function will only be called within another function. Such as my checkAuthId(). If an error is found, it is then added to my error log table. Thanks for the help! Quote Link to comment https://forums.phpfreaks.com/topic/198772-i-cannot-see-the-error-simple-fix/#findComment-1043218 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.