Jump to content

My Login Script


Recommended Posts

Please help me out

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>Register!</title></head><body><form action='register.php' method='POST'>Username: <input type='text' name='username'><br>Password: <input type='password' name='password'><br><input name="register" type="submit" value="Submit"></form><?phpinclude('config.php');///variables...$submit=$_POST['register'];$username = mysql_real_escape_string(strip_tags(htmlspecialchars($_POST['username'])));$password = md5($_POST['password']);//if button is pressedif($submit){//if username is not blank..same for passif(($username) and ($password) and ($username!==NULL) and ($password!==NULL)){$check="SELECT id FROM school WHERE username='".$username."'";$result = mysql_query($check) or die(mysql_error());$num_rows = mysql_num_rows($result); if ($num_rows != 0) { echo "Sorry, there the username $username is already taken.<br>";echo "<a href=register.html>Try again</a>";exit;}else{ $sql="INSERT INTO `users` (`id`,`username`,`password`) VALUES ('NULL','".$username."','".$password."')";mysql_query($sql) or die(mysql_error());echo "Congratulations! You are registered!<br><a href='index.php'>Log in</a>";}}}?></body></html>

the erro i'm experiencing is "Table 'school.school' doesn't exist"and i have my table "school created.

Edited by Panta
Link to comment
Share on other sites

check your database , your page code and your config.php for any typo's you've made in any sql query's.
i have done that. but could not see any erro. this is my config.php
<?php    $dbhost   = 'localhost';    $dbname   = 'school';    $dbusername   = '*****';    $dbuserpass = '******';        mysql_connect ($dbhost, $dbusername, $dbuserpass);mysql_select_db($dbname) or die('Cannot select database');?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...