Jump to content

My Login Script


Panta

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.

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

I do believe you call for your database incorrectly , when I apply this script with 2 blank tables to substitute i find that the script itself works perfectly well.Only explanation can be that your database connection isn't propper! :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...