Panta Posted December 11, 2009 Report Share Posted December 11, 2009 (edited) 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 December 11, 2009 by Panta Link to comment Share on other sites More sharing options...
yoded Posted December 11, 2009 Report Share Posted December 11, 2009 check your database , your page code and your config.php for any typo's you've made in any sql query's. Link to comment Share on other sites More sharing options...
Panta Posted December 11, 2009 Author Report Share Posted December 11, 2009 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 More sharing options...
yoded Posted December 11, 2009 Report Share Posted December 11, 2009 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 More sharing options...
Panta Posted December 12, 2009 Author Report Share Posted December 12, 2009 THANKS , THE PROBLEM IS THAT I DIDN'T CHOICE THE CORRECT DATABASE NAME.IS NOW WORKING PERFECTELY. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now