Jump to content
Killersites Community

phpNOvice

Member
  • Content Count

    44
  • Joined

  • Last visited

Everything posted by phpNOvice

  1. phpNOvice

    Renaming Uploaded Photo

    this has been solved
  2. phpNOvice

    Renaming Uploaded Photo

    Hello killers, I have manage to create codes that could upload a image that is purposely to serve as profile picture of a certain student. My problem is how to rename it to aN AUTO COLLATE UNIQUE ID NUMBER so that i can display it specifically to a certain student account which bears the unique id number. The variable is $student_id. <?php session_start(); $session_id = $_SESSION['user_id']; if($session_id == null){ header("location:Student_Edit.php"); die(); } include 'Connect.php'; $flag = ""; $result = mysql_query("SELECT * FROM student_information where student_id='{$_SESSION['user_id']}'",$link_id);; $data = mysql_fetch_array($result); ?> <div class="style3" > <?php $uploadpath = 'upload/'; $max_size = 2000; $alwidth = 900; $alheight = 800; $allowtype = array('bmp', 'gif', 'jpg', 'jpe', 'png','psd'); if(isset($_FILES['fileup']) && strlen($_FILES['fileup']['name']) > 1) { $uploadpath = $uploadpath . basename( $_FILES['fileup']['name']); $sepext = explode('.', strtolower($_FILES['fileup']['name'])); $type = end($sepext); list($width, $height) = getimagesize($_FILES['fileup']['tmp_name']); $err = ''; if(!in_array($type, $allowtype)) $err .= 'The file: <b>'. $_FILES['fileup']['name']. '</b> not has the allowed extension type.'; if($_FILES['fileup']['size'] > $max_size*1000) $err .= '<br/>Maximum file size must be: '. $max_size. ' KB.'; if(isset($width) && isset($height) && ($width >= $alwidth || $height >= $alheight)) $err .= '<br/>The maximum Width x Height must be: '. $alwidth. ' x '. $alheight; if($err == '') { if(move_uploaded_file($_FILES['fileup']['tmp_name'], $uploadpath)) { echo 'File: <b>'. basename( $_FILES['fileup']['name']). '</b> successfully uploaded:'; echo '<br/>File type: <b>'. $_FILES['fileup']['type'] .'</b>'; echo '<br />Size: <b>'. number_format($_FILES['fileup']['size']/1024, 3, '.', '') .'</b> KB'; if(isset($width) && isset($height)) echo '<br/>Image Width x Height: '. $width. ' x '. $height; echo '<br/><br/>Image address: <b>http://'.$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['REQUEST_URI']), '\\/').'/'.$uploadpath.'</b>'; } else echo '<b>Unable to upload the file.</b>'; } else echo $err; } ?> Please modify my codes to rename the uploaded file to the student id of the student who is uploading it.
  3. Hello Ben, i have solved the flag part but still the problem of uploading image is there even i have followed your advise in enctype="multipart/form-data" which i have missed also last time. I got brand new codes now and best thing is i got WARNING displayed. Kindly help me this out. <?php error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); session_start(); $session_id = $_SESSION['user_id']; if($session_id == null){ header("location:Student_Edit.php"); die(); } include 'Connect.php'; $flag = ""; $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']; $imagename = ""; $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='{$_SESSION['user_id']}'"; $result = mysql_query($query, $link_id); if(mysql_error() != null){ die(mysql_error()); } 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/".$student_id; $userfile_tmp_name = $_FILES['image']['tmp_name']; if(move_uploaded_file($userfile_tmp_name, $archive_dir)){ mysql_query("update student_information set image='$imagename' where student_id='{$_SESSION['user_id']}'", $link_id); $flag = "success"; if(mysql_error()!=null){ die(mysql_error()); } } else{ if(file_exists('images/' . $imagename)) { unlink('images/' . $imagename); } rollbackData(); } } else{ if(file_exists('images/' . $imagename)) { unlink('images/' . $imagename); } rollbackData(); die("You can upload image of 1 MB size only. Please, try again."); } } else{ if(file_exists('images/' . $imagename)) { unlink('images/' . $imagename); } rollbackData(); die("You can upload images of .jpg, .jpeg, .gif extensions only. Please, try again. "); } } if($result){ $flag = "success"; } else{ $flag = "error"; } header("location:Student_Edit.php?flag=$flag&student_id='{$_SESSION['user_id']}'"); ?> and these are the 3 warnings displayed except for being deprecated maybe you can figure this out. Warning: move_uploaded_file(images/<br /> <b>Notice</b>: Undefined variable: student_id in <b>C:\xampp\htdocs\a\Student_Edit.php</b> on line <b>112</b><br /> : failed to open stream: Invalid argument inC:\xampp\htdocs\a\Student_Edit_Handler.php on line 45 Warning: move_uploaded_file(): Unable to move 'C:\xampp\tmp\php87E3.tmp' to 'images/<br /> <b>Notice</b>: Undefined variable: student_id in <b>C:\xampp\htdocs\a\Student_Edit.php</b> on line <b>112</b><br /> ;' in C:\xampp\htdocs\a\Student_Edit_Handler.php on line 45 Fatal error: Call to undefined function rollbackData() in C:\xampp\htdocs\a\Student_Edit_Handler.php on line 56 Please advise
  4. Hello Admins and Php Freaks, 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 Admin Ben that i always doing my best to get those codes but this time i think im lost. 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.
  5. Hi there, i have recieved this notice Warning: Header may not contain more than a single header, new line detected in C:\xampp\htdocs\a\Student_Edit_Handler.php on line 53 and these are my codes. Kindly help me to fix this. <?php session_start(); $session_id = $_SESSION['user_id']; if($session_id == null){ header("location:Student_Edit.php"); die(); } include 'Connect.php'; $flag = "success"; function rollbackData(){ mysql_query(" ROLLBACK "); global $flag; $flag = "error"; if(mysql_error() != null){ die(mysql_error()); } } $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']; $imagename = ""; $flag= ""; mysql_query("SET AUTOCOMMIT = 0 "); if(mysql_error() != null){ die(mysql_error()); } $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='{$_SESSION['user_id']}'"; $result = mysql_query($query, $link_id); if(mysql_error() != null){ die(mysql_error()); } if($result) { $flag = "success"; } else { $flag = "error"; } header("location:Student_Edit.php?flag=$flag&student_id=student_id=$student_id"); ?> Please advise
  6. These are my codes in the html <tr class="stylesmall"> <td>Update Learner Image: </td> <td colspan="3"><input type="file" name="image"> <span class="style3"> <span class="stylesmall">jpg or gif file only</span></span></td> </tr> <tr> <td colspan="4"><span class="stylered style6"><span class="style3">*</span> <em>fields are compulsory</em></span></td> </tr> <tr> <td colspan="4" align="center"><input name="update" type="submit" id="update" value="Update"> i read the link you gave me and tried to modify some codes but then it end up same error.
  7. i have writen flags on theStudent_Edit.php. <?php if(!empty($_GET['flag']) && $_GET['flag'] == "success") { ?> <span class="stylered style1"><span class="style5">Learner Information updated successfully.</span></span> <?php } else if(!empty($_GET['flag']) && $_GET['flag'] == "error") { ?> <span class="stylered style3 style5"><span class="style1">Error while updating Learner Information. Please try again</span></span> <?php } ?> </td> the specific error im getting is the flag=error which is "Error while updating Learner Information. Please try again." The reason im pasting almost the whole codes.
  8. Hi Ben, i got new codes now that uploads the image of registered student with unique student_id. it is called Student_Edit_handler. This was in response to the idea you suggested. $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']; $imagename = ""; $flag= ""; mysql_query("SET AUTOCOMMIT = 0 "); if(mysql_error() != null){ die(mysql_error()); } $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='{$_SESSION['user_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's image */ 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 .'/'. $student_id .'_'. $imagename .'.'. $ext)){ /* if image is successfully uploaded then imagename is stored in database. */ mysql_query("update student_information set image='$imagename' where student_id='{$_SESSION['user_id']}'", $link_id); $flag = "success"; if(mysql_error()!=null){ die(mysql_error()); } }else{ if(file_exists('images/' . $imagename)) { unlink('images/' . $imagename); } rollbackData(); } }else{ if(file_exists('images/' . $imagename)) { unlink('images/' . $imagename); } rollbackData(); die("You can upload image of 1 MB size only. Please, try again."); } }else{ if(file_exists('images/' . $imagename)) { unlink('images/' . $imagename); } 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()); } } header("location:Student_Edit.php?flag=$flag"); die(); ?> the problem left now is the image wont upload and it flags the error. i know this has been a lot but i need you to help me modify these codes.
  9. ok got it ben,, i think i would accept your suggestion to keep registration process simple, that is always what im thinking all night long, thank you for confirming it. i'll work the codes now and put the adding of image on the Update profile. Please stand by Ben, i may need your help after this ;-)
  10. Yes Ben, I understand your codes in fact that is what i am using. Actually, this is still on the process when the student register themselves-Registration_handler.php'. I suppose in this instance the student_id is not yet created. This is the registration page where the student filled-up information including the uploading of their image.
  11. Sorry to bother you Ben, There has been slightly changes since i am also working in solving the scenario. here is now my current codes. 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 .'/'. $student_id .'_'. $imagename .'.'. $ext)){ this codes can upload an image. there is no error. the image is uploaded succesfully. Example if the uplaoded file has a file name pic.jpg,,after it has been succesfully upload it is rename to "_pic.jpg" without the quotes just underscore and the file name itself. What i wanted is to rename it to its unique student_id number so i can display it smoothly to another page.
  12. This is so far what i got Ben and i failed to rename the uploaded file to its $student_id. 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")){ The file has been succesfully uploaded Ben but help me to insert the codes which to rename its file name to its student_id so i can display it to another page smoothly.
  13. phpNOvice

    Error In Updating Learner Information

    Hello Ben, hahaha,, i am so dumb!! Why i haven't think of that....thank you for that hint Ben.. I solve it,,and for the benefit of those future reader on this thread. ill post the solution. $query = "UPDATE student_information SET learner_id='$learner_id',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='{$_SESSION['user_id']}'"; $result = mysql_query($query, $link_id); if(mysql_error() != null){ die(mysql_error()); } else{ $flag="success"; } header("location:Student_Edit.php?flag=$flag&student_id='{$_SESSION['user_id']}'"); ?> Thank you Ben.
  14. Hello everyone, I am confused with these little codes why it keeps error in updating the learner information. These are my codes so far. These are the bits of Student_Info.php which i think would be useful in my query. <?php if(!empty($_GET['flag']) && $_GET['flag'] == "success") { ?> <span class="stylered style1"><span class="style5">Learner Information updated successfully.</span></span> <?php } else if(!empty($_GET['flag']) && $_GET['flag'] == "error") { ?> <span class="stylered style3 style5"><span class="style1">Error while updating Learner Information. Please try again</span></span> <?php } ?> </td> This is the Student_Edit_Handler codes. <?php session_start(); $session_id = $_SESSION['user_id']; if($session_id == null){ header("location:Student_Edit.php"); die(); } include 'Connect.php'; $flag = ""; $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']; $query = "UPDATE student_information SET learner_id='$learner_id',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='{$_SESSION['user_id']}'"; $result = mysql_query($query, $link_id); if(mysql_error() != null){ die(mysql_error()); } else{ $flag="error"; } if($flag == "success"){ mysql_query(" COMMIT "); $flag="success"; if(mysql_error() != null){ die(mysql_error()); } } header("location:Student_Edit.php?flag=$flag&student_id='{$_SESSION['user_id']}'"); ?> It flags the error on else{$flag="error";} I am stuck with these codes guys, please do help me modify it so learner information will be update.
  15. phpNOvice

    Log In Student With Unique Id

    Nevermind bro, i already solved it.
  16. Good day Admins, I have now variables $learner_id $student_pasword $student_id The learner_id and student_password are being used as their log in accounts. While the student_id is being used as their unique id and it is auto-incremented. Here are my codes. Student_login_handler.php <?php session_start(); include 'Connect.php'; $flag = ""; $learner_id = $_POST['learner_id']; $student_password = $_POST['student_password']; $query = "select last_login_date from student_information where learner_id='$learner_id' and student_password='$student_password'"; $result = mysql_query($query,$link_id); if(mysql_error() != null){ die(mysql_error()); } if($date = mysql_fetch_array($result)) { $lastdate = $date['last_login_date']; $date2 = date("d-m-Y h:i A",strtotime($lastdate)); $_SESSION["user_id"] = $_POST["student_id"]; $_SESSION["lastlogin"] =$date2; $_SESSION["type"] = "Student"; mysql_query("UPDATE student_information SET last_login_date=now() where student_id='$GET[id]'",$link_id); if(mysql_error() != null){ die(mysql_error()); } header("location: Student_Home.php?id={$student_id}"); die(); } else { $flag = "invalid"; header("location:Student_login.php?flag=$flag"); die(); } ?> This is so far what i've got and it's wrong. Help me to modify this gentlemen to achieve the objectives given above. It directs me to URL http://localhost/a/Student_Home.php?id= which i expect to be http://localhost/a/Student_Home.php?id=51 (51 is the auto-incremented student_id, bears unique id of student)
  17. phpNOvice

    Log In Student With Unique Id

    Ben or Sir Jet,, please.
  18. phpNOvice

    Log In Student With Unique Id

    Dear Sir, Sometimes i suspect that the problem is in the Student_Home.php because i am directed to that page already, Could it be possible?
  19. phpNOvice

    Log In Student With Unique Id

    Hello there Sir Ben, Uhh Yes, they have to log in to their user account using their learner_id and student_password. Im sorry for that, Here is my Student_login.php <td width="35%" align="left" class="style7 style1">Learner Id : </td> <td width="65%" align="left"><input name="learner_id" type="text" id="learner_id" action="Student_Home.php" method="post"></td> </tr> <tr bgcolor="#E1E1E1" class="stylesmall"> <td align="left" class="style7 style1">Password:</td> <td align="left"><input name="student_password" type="password" id="student_password"></td> </tr> <tr bgcolor="#E1E1E1"> <td colspan="2" align="center"> <?php if(!empty($_GET['flag']) && $_GET['flag'] == "invalid") { ?> <span class="stylered style1">Invalid Learner Id or Password</span> <?php }?></td> </tr> <tr bgcolor="#E1E1E1"> <td colspan="2" align="center"> <p><input name="login" class="style10" type="submit" id="login" value="Login"></p> I have updated my previous comment because from time to time i am also working with these codes with your guidance.
  20. phpNOvice

    Display Image Of A Specific Student

    Hello Admin, This is my upload code if($result){ if($_FILES['image']['name'] != ""){ $filename = $_FILES['image']['name']; $ext = strrchr($filename,"."); $imagename = $student_id; if($ext ==".jpg" || $ext ==".jpeg" || $ext ==".JPG" || $ext ==".JPEG" || $ext ==".gif" || $ext ==".GIF"){ $size = $_FILES['image']['size']; if($size > 0 && $size < 5000000){ $archive_dir = "images"; $userfile_tmp_name = $_FILES['image']['tmp_name']; if(move_uploaded_file($userfile_tmp_name, "$archive_dir/$imagename")) and the image is successfully uploaded to xampp/htdocs/a/images with the student id (not the unique number) is the file name. The same codes for display_image.php and the student_view.php as shown above. But still no luck the image still broken. Please advise.
  21. Hello there Admins, I would like to display the image on his/her profile. This is so far the codes i have made. It displays only the outline border of the image but not the student's image itself. <?php session_start(); $session_id = $_SESSION['admin_id']; if($session_id == null){ header("location:Admin_Home.php"); die(); } include 'Connect.php'; $student_id = htmlentities($_REQUEST['id'], ENT_QUOTES); $result = mysql_query("SELECT * FROM student_information where student_id='$_GET[id]'"); $data = mysql_fetch_array($result); $numRows = mysql_numrows($result); $i = 0; while($i < $numRows) { ?> <img src="display_image.php?id=<?php echo mysql_result($data,$i,"id"); ?>" width="175" height="200" <?php $i++; } ?> Please advise me how to modify these codes to make the image display. By the way this is the display_image.php i created. <?php include 'Connect.php'; $flag = ""; $student_id = htmlentities($_REQUEST['id'], ENT_QUOTES); if (IsSet($_GET['id'])){ $result = @mysql_query("select * from student_information where student_id = ".$_GET['id']); header("Content-type: image/jpeg"); header("Pragma: public"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" ); header("Content-Transfer-Encoding: binary"); header("Content-Type: PHP Generated Data"); header("Content-Length: ".filesize($filename)); while ($data = mysql_fetch_array($result)) { print $data['LRCard'];} mysql_free_result($result); } ?>
  22. phpNOvice

    Converting Mysql To Mysqli

    thanks Ben and Stefan, I'll come back to this post after i completed and run first my whole system in mysql.... It's better i'll finish this first before i'l get concentrating it converting it to my_sqli. Thank you both.
  23. phpNOvice

    Display Image Of A Specific Student

    Wow Stef,, Why did i never thought of that,,i'll debug my codes later to change image name to its id(on the upload page codes)..see if i can work it.. I'll update you soon. Thank you for the idea.
×