damiendarien Posted September 7, 2010 Share Posted September 7, 2010 I am having an issue with this code. Im trying to find the problem listed as the error but i might need someone from the outside to look at it for me. <?php if (empty($_GET['email']) || empty($_GET['email_confirm']) || empty($_GET['password']) || empty($_GET['password_confirm'])) exit("<p>You must enter values in all fields of the Frequent Flyer Registration form! Click your browser's Back button to return to the previous page.</p>"); else if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_GET['email'])) exit("<p>You must enter a valid e-mail address! Click your browser's Back button to return to the previous page.</p>"); else if ($_GET['email'] != $_GET['email_confirm']) exit("<p>You did not enter the same e-mail address! Click your browser's Back button to return to the previous page.</p>"); else if ($_GET['password'] != $_GET['password_confirm']) exit("<p>You did not enter the same password! Click your browser's Back button to return to the previous page.</p>"); else if (strlen($_GET['password']) < 5 || strlen($_GET['password']) > 10) exit("<p>Your password must be between 5 and 10 characters! Click your browser's Back button to return to the previous page.</p>"); $DBConnect = @mysqli_connect("localhost", "********", "********") Or die("<p>Unable to connect to the database server.</p>" . "<p>Error code " . mysqli_connect_errno() . ": " . mysqli_connect_error()) . "</p>"; $DBName = "skyward_aviation"; @mysqli_select_db($DBConnect, $DBName) Or die("<p>Unable to select the database.</p>" . "<p>Error code " . mysqli_errno($DBConnect) . ": " . mysqli_error($DBConnect)) . "</p>"; $TableName = "frequent_flyer"; $Email = addslashes($_GET['email']); $Password = addslashes($_GET['password']); $SQLstring = "SELECT * FROM $TableName"; $QueryResult = @mysqli_query($DBConnect, $SQLstring); if (mysqli_num_rows($QueryResult) > 0) { $Row = mysqli_fetch_row($QueryResult); do { if (in_array($Email, $Row)) exit("<p>The e-mail address you entered is already registered! Click your browser's Back button to return to the previous page.</p>"); $Row = mysqli_fetch_row($QueryResult); } while ($Row); mysqli_free_result($QueryResult); $SQLstring = "INSERT INTO $TableName VALUES(NULL, '$Email', '$Password', NULL, NULL, NULL, NULL, NULL, NULL, NULL)"; $QueryResult = @mysqli_query($DBConnect, $SQLstring) Or die("<p>Unable to execute the query.</p>" . "<p>Error code " . mysqli_errno($DBConnect) . ": " . mysqli_error($DBConnect)) . "</p>"; $FlyerID = mysqli_insert_id($DBConnect); mysqli_close($DBConnect); ?> <p>Your new frequent flyer ID is <strong> <?= $FlyerID ?></strong>.</p> here is the error on the page Parse error: syntax error, unexpected $end in C:\xampp\htdocs\PHP_Projects\Chapter.10\RegisterFlyer.php on line 73 Thanks for any help on this issue, ive been going crazy Quote Link to comment Share on other sites More sharing options...
Hypnos Posted September 7, 2010 Share Posted September 7, 2010 No closing bracket after your last if statement. Quote Link to comment Share on other sites More sharing options...
taquitosensei Posted September 7, 2010 Share Posted September 7, 2010 You beat me to it. Quote Link to comment Share on other sites More sharing options...
damiendarien Posted September 7, 2010 Author Share Posted September 7, 2010 thanks. i knew all it would take is another set of eyes to view it and solve. Had another issue but it was another simple mistake on mislabeling variables. But now i have the issue to where when it is trying to show results inside the body element <?= $FlyerID => but in the page it doesnt show up. How can i fix this? is it something in the php.ini file? Also for some reason when i go through the pages to the site it doenst hold the username and password and says i need to sign in again. What would cause that? Thanks again Quote Link to comment Share on other sites More sharing options...
WatsonN Posted September 7, 2010 Share Posted September 7, 2010 On the topic of holding the username and password did you try using a cookie? Quote Link to comment Share on other sites More sharing options...
damiendarien Posted September 7, 2010 Author Share Posted September 7, 2010 no that is in the next section working on that now. but it is SUPPOSED!!(being the relative term) to work without cookies. llol 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.