Jump to content


  • Content Count

  • Joined

  • Last visited

Posts posted by Panta

  1. 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');?>

  2. 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.

  3. please my friends this has been my problem. this time what the erro message is "Parse error: syntax error, unexpected $end in C:\wamp\www\newform\register2.php on line 47"This is the code...please i need ur help. Thanks

    <?php// Connects to your Databasemysql_connect("localhost", "user", "lpw") or die(mysql_error());mysql_select_db("Database_Name") or die(mysql_error());//This code runs if the form has been submittedif (isset($_POST['submit'])) {//This makes sure they did not leave any fields blankif (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) {die('You did not complete all of the required fields');}// checks if the username is in useif (!get_magic_quotes_gpc()) {$_POST['username'] = addslashes($_POST['username']);}$usercheck = $_POST['username'];$check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'")or die(mysql_error());$check2 = mysql_num_rows($check);//if the name exists it gives an errorif ($check2 != 0) {die('Sorry, the username '.$_POST['username'].' is already in use.');}// this makes sure both passwords entered matchif ($_POST['pass'] != $_POST['pass2']) {die('Your passwords did not match. ');}// here we encrypt the password and add slashes if needed$_POST['pass'] = md5($_POST['pass']);if (!get_magic_quotes_gpc()) {$_POST['pass'] = addslashes($_POST['pass']);$_POST['username'] = addslashes($_POST['username']);}// now we insert it into the database$insert = "INSERT INTO users (username, password)VALUES ('".$_POST['username']."', '".$_POST['pass']."')";$add_member = mysql_query($insert);?>

    Solved. Thanks

  4. please i dont know the problem with this login script. the error message is Fatal error: Call to undefined function msql_query() in C:\wamp\www\newform\login.php on line 33

    //connect to the mysql database server.mysql_connect ($dbhost, $dbusername, $dbuserpass);mysql_select_db($dbname) or die('Cannot select database');$page_mode = isset($_POST['page_mode']) ? $_POST['page_mode'] : '';$error_string = '';if ($page_mode == 'login'){  $email = $_POST['email'];  $password = $_POST['password'];  if (trim($email) == '' || trim($password) == '')    {	$error_string .= 'Please enter your email address and password.<br>';	}	}  else  {    		$query = msql_query("SELECT * FROM users WHERE email='" . mysql_real_escape_string($email) . "'");	$data = mysql_fetch_array($query);	if($data['password'] != $password) {echo "The supplied login is incorrect";}else{$query = mysql_query("SELECT* FROM users WHERE email='" . mysql_real_escape_string($email) . "'") ;$row = mysql_fetch_array($query);      $_SESSION['user_id'] = $row['id'];      $_SESSION['user_name'] = $row['name'];      $_SESSION['user_email'] = $row['email'];      header('Location: index.php');      exit();    }  }?>

  5. // connect to the mysql database server.mysql_connect ($dbhost, $dbusername, $dbuserpass);mysql_select_db($dbname) or die("Cannot select database");//Are they just getting here or submitting their info?if (isset($_POST["username"])) {$username = $_POST["username"];$password = $_POST["password"];$cpassword = $_POST["cpassword"];$email = $_POST["email"];//Was a field left blank?if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL) {echo "A field was left blank.";}else{//Do the passwords match?if($password!=$cpassword) {echo "Passwords do not match";}else{//Has the username or email been used?$checkuser = mysql_query("SELECT username FROM users WHERE username='$username'");$username_exist = mysql_num_rows($checkuser);$checkemail = mysql_query("SELECT email FROM users WHERE email='$email'");$email_exist = mysql_num_rows($checkemail);if ($email_existɬ|$username_existɬ) {echo "The username or email is already in use";}else{$pin = rand(1000000000,9999999999);//Everything seems good, lets insert.$query = "INSERT INTO users (username, password, email,regno) VALUES('$username','$password','$email','$pin')";mysql_query($query) or die(mysql_error());echo "The user $username has been successfully registered.";echo "Your reg no is" $pin;}}}}?><h1>Register</h1><form action="register.php" method="POST"><table style="border:1px solid #000000;"><tr><td align="right">Username: <input type="text" size="15" maxlength="25" name="username"></td></tr><tr><td align="right">Password: <input type="password" size="15" maxlength="25" name="password"></td></tr><tr><td align="right">Confirm Password: <input type="password" size="15" maxlength="25" name="cpassword"></td></tr><tr><td align="right">Email: <input type="text" size="15" maxlength="25" name="email"></td></tr><tr><td align="center"><input type="submit" value="Register"></td></tr><tr><td align="center"><a href="login.php">Login Here</a></td></tr></table></form></center>

    This is my script but i don't know where the problem is coming from.i guess the script is having a little erro.Plz help me

  6. please i need to know how to write a script that will change the content of Department on selection of Faculty.What i mean is maybe on selection of Sciences from Faculty, the content of Department will change to Science Departments.


  7. please i need to know how to write a script that will change the content of Department on selection of Faculty.What i mean is maybe on selection of Sciences from Faculty, the content of Department will change to Science Departments.


  8. Please nice friends i have been trying to write a script that will upload pix to database and also pull it out to the browser, But i have been having problem with my code, Plz help me out. This is the code. Thanks

    <?php$db = mysql_connect("localhost","Austin","password");mysql_select_db("school");$pname = $_REQUEST['pname'];$pdesc = $_REQUEST['pdesc'];$ftype = $_FILES['pfile']['type'];$fname = $_FILES['pfile']['name'];if ($_FILES['pfile']['size'] <= $_REQUEST['MAX_FILE_SIZE']){$fdata = fread(fopen($_FILES['pfile']['tmp_name'], "rb"),$_FILES['pfile']['size']);$fdata = base64_encode($fdata);$sql = "INSERT INTO pictures “;$sql .= “(poster_name,pdesc,ftype,fname,fdata) VALUES “;$sql .= “(\"${pname}\",\"${pdesc}\",”;$sql .= “\"${ftype}\",\"${fname}\",\"${fdata}\")";$query = mysql_query($sql) or die(mysql_error());echo "File Uploaded!";} elseecho "File Too Large";?>

  • Create New...