cheekydump Posted August 17, 2007 Share Posted August 17, 2007 i am learning php from php and mysql book and i have worked tho to the register.php and i am a bit stuck as when i submit my registation it comes up with System Error You could not be registered due to system error. we apologize for any inconvenience. Query was empty Query: there is no error msg showing and looks like i have connected to my datebase. but noidea how come its not adding the data in it here is a link to it: http://total-art.maxiesub.com/register.php plz could you have a look and try help me plz Quote Link to comment https://forums.phpfreaks.com/topic/65378-need-help-with-my-registerphp/ Share on other sites More sharing options...
beboo002 Posted August 17, 2007 Share Posted August 17, 2007 plz send ur php code in forums Quote Link to comment https://forums.phpfreaks.com/topic/65378-need-help-with-my-registerphp/#findComment-326498 Share on other sites More sharing options...
cheekydump Posted August 17, 2007 Author Share Posted August 17, 2007 <?php $_page_title = 'Register'; include ('./includes/header.html'); // Check if the form has been submitted. if (isset($_POST['submitted'])) { $errors = array(); //Initialize error array. //check for first name if (empty($_POST['first_name'])) { $errors[] = ' You forgot to enter your first name.'; } else { $fn = trim($_POST['first_name']); } //check last name if (empty($_POST['last_name'])) { $errors[] = 'You forgot to enter your last name.'; } else { $ln = trim($_POST['last_name']); } //check for an email address. if (empty($_POST['email'])) { $errors[] = 'You forgot to enter your email address'; } $e = trim($_POST['email']); } //check for a password and match against the confirmed password if (!empty($_POST['password1'])) { if ($_POST['password1'] != $_POST['password2']) { $errors[] = 'your password did not match the confirmed password.'; } else { $p = trim($_POST['password1']); } } else { $errors[] = 'you forgot to enter your password.'; } if (empty($errors)) { //if everyting's okay. //register the user in database. require_once ('../mysql_connect.php'); //connect to the db. //make tge quary. $quary = "INSERT INTO users (first_name, last_name, email, password, registration_date) VALUES ('$fn'. '$ln', '$e', SHA('$p'), NOW() )"; $result = @mysql_query ($query); //run the query. if ($result) {//if it ran OK. //send an email if desired. //pint a message. echo '<h1 id="mainhead"> Thank you!</h1> <p> you are now registered. Now you can login!</p><p><br /> </p>'; //include the footer and quit the script (to not show the form). include ('./includes/footer.html'); exit(); } else { //if it did not run OK. echo '<h1 id="mainhead"> System Error</h1> <p class="error"> You could not be registered due to system error. we apologize for any inconvenience.</p>'; //public message. echo '<p>' . mysql_error(). '<br /><br /> Query:' .$query. '</p>'; //Debugging message. include ('./includes/footer.html'); exit(); } mysql_close(); //close the datebase connection } else { //report errors. echo '<h1 id="mainhead">Error!</h1> <p class="error">The following error(s) occurred:<br />'; foreach ($errors as $msg) { //print each error. echo " - $msg<br />\n"; } echo '</p><p>Please try again.</p><p><br /></p>'; } //end of it (empty($errors)) IF. // end of the main submint conditinal. ?> <body text="#FFFFFF" bgcolor="#000000"> <h2>Register</h2> <form action="register.php" method="post"> <p>First Name: <input type="text" name="first_name" size="15" maxlength="15" value="<?php if (isset($_POST['first_name'])) echo $_POST['first_name']; ?>" /></p> <p>Last Name: <input type="text" name="last_name" size="15" maxlength="30" value="<?php if (isset($_POST['last_name'])) echo $_POST['last_name']; ?>" /></p> <p>Email Adress: <input type="text" name="email" size="20" maxlength="40" value="<?php if (isset($_POST['email'])) echo $_POST['eamil']; ?>" /></p> <p>Password: <input type="password" name="password1" size="10" maxlength="20" /></p> <p>Confirm Password: <input type="password" name="password2" size="10" maxlength="20" /></p> <p><input type="submit" name="submit" value="Register" /></p> <input type="hidden" name="submitted" value="TRUE" /> </form> <?php include ('./includes/footer.html'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/65378-need-help-with-my-registerphp/#findComment-326709 Share on other sites More sharing options...
Anzeo Posted August 17, 2007 Share Posted August 17, 2007 $quary = "INSERT INTO users (first_name, last_name, email, password, registration_date) VALUES ('$fn'. '$ln', '$e', SHA('$p'), NOW() )"; $result = @mysql_query ($query); //run the query. You made a typo there. Quote Link to comment https://forums.phpfreaks.com/topic/65378-need-help-with-my-registerphp/#findComment-326716 Share on other sites More sharing options...
cheekydump Posted August 17, 2007 Author Share Posted August 17, 2007 Thanks and i made another misstace with putting . and i should have put , o well i am can now reg so i am happy just have to make the login script now Quote Link to comment https://forums.phpfreaks.com/topic/65378-need-help-with-my-registerphp/#findComment-326845 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.