Advertisement
Guest User

Untitled

a guest
Jul 16th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $conn = mysql_connect ($servername , $username , $password) or die("unable to connect to host");
  6. $sql = mysql_select_db ('vcet',$conn) or die("unable to connect to database");
  7.  
  8.  
  9.  
  10.  
  11. //code to insert into db...change the ussername and eamil to the respective fields in the form....
  12.  
  13. $user_info = "INSERT INTO studentinfo (user_name, roll_number, user_batch,user_from,user_year, user_level, F_name, m_name, g_name, mob_number, addressline1, addressline2, city, pmob_number, land_number, cutoff, dept, medium, locality, intrest, scholar, income, user_caste, user_admit, user_stay) VALUES ('".$_POST[user_name]."', '".$_POST[roll_number]."','".$_POST[user_batch]."','".$_POST[user_from]."','".$_POST[user_year]."','".$_POST[user_level]."','".$_POST[F_name]."','".$_POST[m_nam e]."','".$_POST[g_name]."','".$_POST[mob_number]."','".$_POST[addressline1]."',' ".$_POST[addressline2]."','".$_POST[city]."','".$_POST[pmob_number]."','".$_POST [land_number]."','".$_POST[cutoff]."','".$_POST[dept]."','".$_POST[medium]."','" .$_POST[locality]."','".$_POST[intrest]."','".$_POST[scholar]."','".$_POST[incom e]."','".$_POST[user_caste]."','".$_POST[user_admit]."','".$_POST[user_stay]."') ";
  14. if (!mysql_query($user_info, $connect)) { die('Error: ' . mysql_error()); } echo “Your information was added to the database.”;
  15. mysql_close($connect);
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement