Panta Posted December 11, 2009 Share Posted December 11, 2009 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 More sharing options...
yoded Posted December 11, 2009 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 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 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 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
Archived
This topic is now archived and is closed to further replies.