captaintyson Posted August 10, 2008 Share Posted August 10, 2008 I keep getting this error "Parse error: syntax error, unexpected T_VARIABLE in /home/pacifij1/public_html/sunflightva/applications/finishapp.php on line 16" after submitting my form, I have asked my friend but he has no clue either. Here is my code <?php //Post from previus form $callsign = $_POST['callsign']; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $email = $_POST['email']; $pwd = $_POST['pwd']; $dob = $_POST['dob']; $city = $_POST['city']; $state = $_POST['state']; $country = $_POST['country']; //Generate Key $key = "1234567890AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz,20" $keycode = shuffle("$key"); //Connect to database and check mysql_select_db($database,$yrbo); $query_key = "SELECT * FROM `roster` WHERE `key` = '$keycode'"; $key = mysql_query($query_key, $yrbo) or die(mysql_error()); $row_key = mysql_fetch_assoc($key); //Count recieved rows $totalRows_key = mysql_num_rows($key); //If rows are found, re-generate if($totalRows_key > 0) { //Re-generate key $keycode = str_shuff("1234567890AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz,20"); //Otherwise, if no recieved rows }else{ } $hostname = "localhost"; $database = ""; $username = ""; $password = ""; $vrbo = mysql_connect($hostname, $username, $password) or die(mysql_error()); //Checks to see if the callsign is taken mysql_select_db($database, $vrbo); $query_pilot = "SELECT * FROM roster where callsign = '$callsign'"; $pilot = mysql_query($query_pilot, $vrbo) or die(mysql_error()); $row_pilot = mysql_fetch_assoc($pilot); $totalRows_pilot = mysql_num_rows($pilot); if ($totalRows_pilot > '0') { echo '<script>alert("Callsign Already in use, please select a new one.");</script>'; echo '<script>history.back(1);</script>'; exit; } //Checks to see if the email is taken mysql_select_db($database, $vrbo); $query_email = "SELECT * FROM roster where email = '$email'"; $email = mysql_query($query_email, $vrbo) or die(mysql_error()); $row_email = mysql_fetch_assoc($email); $totalRows_email = mysql_num_rows($email); if ($totalRows_email > '0') { echo '<script>alert("Email Already in use, please select a new one.");</script>'; echo '<script>history.back(1);</script>'; exit; } //Makes sure email is valid and works if((!strstr($email , "@")) || (!strstr($email , "."))) { echo '<script>alert("You entered an invalid email address");</script>'; echo '<script>history.back(1);</script>'; exit; } //Adds them! mysql_select_db($database, $vrbo); $query_in = "INSERT INTO roster (first_name, last_name, email, pwd, dob, city, state, country, keycode) VALUES ('$first_name', '$last_name', '$email', '$pwd', '$dob', '$city', '$state', '$country', '$keycode')"; $in = mysql_query($query_in, $vrbo) or die(mysql_error()); //Emails US!**US** $to = "[email protected]"; $subject ="A new pilot has signed up"; $message = " A new pilot ($first_name $last_name($callsign)) has signed up. Thanks AquaJet Automated Message "; mail($to, $subject, $message); //Emails THE PILOT!**PILOT** $to_pilot = $email; $subject_pilot ="Verification Link"; $message_pilot = " Hello $first_name, Please click the following link to verify your account and start flying! http://blocked.com/application/verify.php?key=$keycode Thanks AquaJet Automated Message "; mail($to_pilot, $subject_pilot, $message_pilot); ?> Thanks for any help! Link to comment https://forums.phpfreaks.com/topic/118997-syntax-error-unexpected-t_variable/ Share on other sites More sharing options...
genericnumber1 Posted August 10, 2008 Share Posted August 10, 2008 you forgot a semicolon //Generate Key $key = "1234567890AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz,20" should be //Generate Key $key = "1234567890AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz,20"; too lazy to put it in code tags Link to comment https://forums.phpfreaks.com/topic/118997-syntax-error-unexpected-t_variable/#findComment-612751 Share on other sites More sharing options...
captaintyson Posted August 10, 2008 Author Share Posted August 10, 2008 you forgot a semicolon //Generate Key $key = "1234567890AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz,20" should be //Generate Key $key = "1234567890AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz,20"; too lazy to put it in code tags Oh thanks! But now i get this Fatal error: Call to undefined function: str_shuff() in /home/pacifij1/public_html/sunflightva/applications/finishapp.php on line 15 Link to comment https://forums.phpfreaks.com/topic/118997-syntax-error-unexpected-t_variable/#findComment-612754 Share on other sites More sharing options...
genericnumber1 Posted August 10, 2008 Share Posted August 10, 2008 See where it says str_shuff() on line 15? I have a feeling that the function on that line is undefined. Just a hunch... really, just think about it a few minutes or do some googling before you ask us We love to help... just help us help you. Link to comment https://forums.phpfreaks.com/topic/118997-syntax-error-unexpected-t_variable/#findComment-612759 Share on other sites More sharing options...
dannyb785 Posted August 10, 2008 Share Posted August 10, 2008 ^ lol 2nded. Sometimes people don't even read the error messages. If they just would read it and see the line it's at, 95% of them would figure it out themself Link to comment https://forums.phpfreaks.com/topic/118997-syntax-error-unexpected-t_variable/#findComment-612762 Share on other sites More sharing options...
captaintyson Posted August 10, 2008 Author Share Posted August 10, 2008 I actually did a google search for both errors, found out that lots of people posted in forums. I thought I would do the same. But how do i define the str_shuff? Link to comment https://forums.phpfreaks.com/topic/118997-syntax-error-unexpected-t_variable/#findComment-612767 Share on other sites More sharing options...
deadlyp99 Posted August 10, 2008 Share Posted August 10, 2008 How about telling us where you heard or read about the function because google actually turns up blank on that 0.0 Link to comment https://forums.phpfreaks.com/topic/118997-syntax-error-unexpected-t_variable/#findComment-612777 Share on other sites More sharing options...
dannyb785 Posted August 10, 2008 Share Posted August 10, 2008 But how do i define the str_shuff? do you even know what it's supposed to do? Or did you just make it up? Or perhaps you read it from somewhere? Anytime it says variable not defined, it means that it's not a variable in PHP's library of functions and therefore something made up, which you need a definition( by doing "function FUNCTIONNAME() { // stuff } ") in order for it to even do anything. Link to comment https://forums.phpfreaks.com/topic/118997-syntax-error-unexpected-t_variable/#findComment-612780 Share on other sites More sharing options...
captaintyson Posted August 10, 2008 Author Share Posted August 10, 2008 Wow.. This is horrible. You guys are a bunch of a-holes. I found my problom after asking a friend.. Link to comment https://forums.phpfreaks.com/topic/118997-syntax-error-unexpected-t_variable/#findComment-612781 Share on other sites More sharing options...
genericnumber1 Posted August 10, 2008 Share Posted August 10, 2008 What is str_shuff supposed to do? unfortunately we can't advise you on how to fix it until we know that much... looking at the code it seems as if it serves no purpose, but if there's more code I'd suspect it should be shuffle() Try replacing str_shuff with shuffle. Where did you get this piece of code? Edit: Nevermind, you said you got it fixed. Link to comment https://forums.phpfreaks.com/topic/118997-syntax-error-unexpected-t_variable/#findComment-612787 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.