Jump to content

ipsa24

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ipsa24's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. $student_id = $_POST['st_id']; $student_pass = $_POST['st_pass']; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $gender = $_POST['gender']; $contact_no = $_POST['contact_no']; $qualification= $_POST['qualification']; $city = $_POST['city']; $state = $_POST['state']; $country = $_POST['country']; $pin_code = $_POST['pin_code']; $email1 = $_POST['email1']; $address = $_POST['address']; $resumename = ""; $imagename = ""; $dobdate = date("Y-m-d",strtotime($_POST['dob'])); $select_query="select student_id from student_registration where student_id = '$student_id'"; Error : Unknown column 'student_id' in 'field list'
  2. Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\student info system\student_registration_handler.php on line 33 No database selected <?php include 'Connect.php'; $flag = "success"; function rollbackData(){ mysql_query(" ROLLBACK "); global $flag; $flag = "error"; if(mysql_error() != null){ die(mysql_error()); } } $student_id = $_POST['st_id']; $student_pass = $_POST['st_pass']; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $gender = $_POST['gender']; $contact_no = $_POST['contact_no']; $qualification= $_POST['qualification']; $city = $_POST['city']; $state = $_POST['state']; $country = $_POST['country']; $pin_code = $_POST['pin_code']; $email1 = $_POST['email1']; $address = $_POST['address']; $resumename = ""; $imagename = ""; $dobdate = date("Y-m-d",strtotime($_POST['dob'])); /* This block is used to check whether the student_id already exists in database. */ $select_query="select student_id from student_information where student_id = '$student_id'"; $result_set = mysql_query($select_query,$link_id); if($row = mysql_fetch_array($result_set)){ $flag="exists"; header("location:Student_login.php?flag=$flag&student_id=$student_id"); die(); } else{ /* This block is used to insert the student record in databaseif the student_id is already not present in the database. */ mysql_query("SET AUTOCOMMIT = 0 "); if(mysql_error() != null){ die(mysql_error()); } $query = "insert into student_information(student_id,student_password,first_name,last_name,registration_date,gender,date_of_birth,"; $query .="student_status,contact_no,qualification,city,state,country,pin_code,email1,address)"; $query .= "values('$student_id','$student_pass','$first_name','$last_name',now(),'$gender ','$dobdate','Disable','$contact_no',"; $query .="'$qualification','$city','$state','$country','$pin_code','$email1','$address')"; $result = mysql_query($query,$link_id); if(mysql_error() != null){ die(mysql_error()); } if($result){ if($_FILES['resume']['name'] != ""){ $filename = $_FILES['resume']['name']; $ext = strrchr($filename,"."); $resumename = $student_id; $resumename .= "_".$filename; if($ext ==".txt" || $ext ==".doc" || $ext ==".TXT" ||$ext ==".DOC" || $ext ==".pdf" || $ext ==".PDF"){ $size = $_FILES['resume']['size']; if($size > 0 && $size < 1000000){ $archive_dir = "resumes"; $userfile_tmp_name =$_FILES['resume']['tmp_name']; if(move_uploaded_file($userfile_tmp_name, "$archive_dir/$resumename")){ /* if image is successfullyuploaded then resumename is stored in database. */ mysql_query("updatestudent_information set resume='$resumename' wherestudent_id='$student_id'", $link_id); if(mysql_error() != null){ die(mysql_error()); } $flag = "success"; }else{ rollbackData(); } } else{ rollbackData(); die("You can upload resume of 1 MBsize only. Please, try again."); } } else{ rollbackData(); die("You can upload resume of .txt, .pdf,.doc extensions only. Please, try again."); } } if($_FILES['image']['name'] != ""){ $filename = $_FILES['image']['name']; $ext = strrchr($filename,"."); $imagename = $student_id; $imagename .="_". $filename; if($ext ==".jpg" || $ext ==".jpeg" || $ext ==".JPG" ||$ext ==".JPEG" || $ext ==".gif" || $ext ==".GIF"){ $size = $_FILES['image']['size']; if($size > 0 && $size < 1000000){ $archive_dir = "images"; $userfile_tmp_name =$_FILES['image']['tmp_name']; if(move_uploaded_file($userfile_tmp_name, "$archive_dir/$imagename")){ /* if image is successfullyuploaded then imagename is stored in database. */ mysql_query("updatestudent_information set image='$imagename' wherestudent_id='$student_id'", $link_id); $flag = "success"; if(mysql_error()!=null){ die(mysql_error()); } } else { if(file_exists('resumes/' .$resumename)) { unlink('resumes/' .$resumename); } rollbackData(); } } else{ if(file_exists('resumes/' .$resumename)) { unlink('resumes/' .$resumename); } rollbackData(); die("You can upload image of 1 MBsize only. Please, try again."); } } else{ if(file_exists('resumes/' . $resumename)) { unlink('resumes/' . $resumename); } rollbackData(); die("You can upload images of .jpg, .jpeg,.gif extensions only. Please, try again. "); } } } else{ $flag="error"; } if($flag == "success"){ mysql_query(" COMMIT "); $flag="success"; if(mysql_error() != null){ die(mysql_error()); } /* This block is used to send email to the successfully registered users.*/ /* $to = $email1;$subject = 'Congratulations';$message = 'Congratulations you are registered in our site.\r\n\r\n'; $message .= "Your Login Id : $student_id \r\n Password :$student_pass"; $headers = "From: info@sims.com\r\n"; $headers .= 'X-Mailer: PHP' . phpversion(); mail($to, $subject, $message, $headers); */ } header("location:Student_login.php?flag=$flag"); die(); } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.