Guest User

Untitled

a guest
Sep 22nd, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. <?php
  2. @session_start();
  3. $host="localhost";
  4. $username="root";
  5. $password="";
  6. $db_name="school";
  7. $tbl_name="tbl_login";
  8.  
  9. mysql_connect("$host", "$username", "$password")or die("cannot connect");
  10.  
  11. mysql_select_db("$db_name")or die("cannot select DB");
  12.  
  13. $StudentID= $_POST['StudentID'];
  14.  
  15. $Password= $_POST['Password'];
  16.  
  17. $BirthMonth= $_POST['BirthMonth'];
  18.  
  19. $BirthDay= $_POST['BirthDay'];
  20.  
  21. $BirthYear= $_POST['BirthYear'];
  22.  
  23. $result=mysql_query("select * from tbl_login where StudentID='".mysql_real_escape_string($StudentID)."'");
  24.  
  25. $count=mysql_num_rows($result); // This will check the result
  26.  
  27. if($count==1 ){
  28. //$GetName="Select Name FROM $tbl_name WHERE StudentID='$StudentID'"; // getting the name in the DB
  29.  
  30. $Name=mysql_fetch_array($result);
  31. //$Name Declared as a result of the search
  32. $_SESSION['Name'] = $Name['StudentID'];
  33. echo "Welcome ".$Name."";
  34. }
  35. else {
  36.  
  37. echo "Sorry";
  38.  
  39. }
  40. ?>
Add Comment
Please, Sign In to add comment