Guest User

Untitled

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