Hello Admins and Php Friends,
I have manage to upload the image using this codes
$student_id = $_POST['student_id'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$gender = $_POST['gender'];
$date_of_birth = date("Y-m-d",strtotime($_POST['date_of_birth']));
$contact_no = $_POST['contact_no'];
$grade = $_POST['grade'];
$section = $_POST['section'];
$LRN = $_POST['LRN'];
$email1 = $_POST['email1'];
$email2 = $_POST['email2'];
$address = $_POST['address'];
$description = $_POST['description'];
$LRCardname= "";
$LRCard2name= "";
$query = "UPDATE student_information SET first_name='$first_name',last_name='$last_name',";
$query .= "gender='$gender',date_of_birth='$date_of_birth',contact_no='$contact_no',grade='$grade',section='$section',";
$query .= "LRN='$LRN',email1='$email1',email2='$email2',address='$address',description='$description'";
$query .= " WHERE student_id='$student_id'";
$result = mysql_query($query, $link_id);
if(mysql_error() != null){
die(mysql_error());
}
/*
This block shows the start codes for the upload of the Learner Report Card.
*/
if($result){
if($_FILES['LRCard']['name'] != ""){
$filename = $_FILES['LRCard']['name'];
$ext = strrchr($filename,".");
$LRCardname = $student_id;
$LRCardname .="_". $filename;
if($ext ==".jpg" || $ext ==".jpeg" || $ext ==".JPG" || $ext ==".JPEG" || $ext ==".gif" || $ext ==".GIF"){
$size = $_FILES['LRCard']['size'];
if($size > 0 && $size < 5000000){
$archive_dir = "LRCards";
$userfile_tmp_name = $_FILES['LRCard']['tmp_name'];
if(move_uploaded_file($userfile_tmp_name, "$archive_dir/$LRCardname")){
/*
if LRC is successfully uploaded then LRC is stored in database.
*/
mysql_query("update student_information set LRCard='$LRCardname' where student_id='$student_id'", $link_id);
$flag = "success";
if(mysql_error()!=null){
die(mysql_error());
}
}
else{
if(file_exists('LRCard/' . $LRCardname)) {
unlink('LRCards/' . $LRCardname);
}
rollbackData();
}
}
else{
if(file_exists('LRCards/' . $LRCardname)) {
unlink('LRCard/' . $LRCardname);
}
rollbackData();
die("You can upload LRCard of 5 MB size only. Please, try again.");
}
}
else{
if(file_exists('LRCards/' . $LRCardname)) {
unlink('LRCards/' . $LRCardname);
}
rollbackData();
die("You can upload LRCard 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());
}
}
Now i want to display this uploaded image with respect to a specific student with auto incremented unique number. You know Daniweb that i always doing my best to get those codes but this time i think im lost.Please give me the codes to write on another page like Student_Home.php to make this uplaoded images display.
I want this image to be displayed on another page. Please help me this time with the codes and ill do the rest.
Please and another please. I always beleive in your expertise in CRUDE.