Jump to content
Stef's Coding Community

phpNOvice

Member
  • Content Count

    44
  • Joined

  • Last visited

Everything posted by phpNOvice

  1. 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_inform
  2. 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['fi
  3. 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
  4. 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
  5. 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=e
  6. 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'];
  7. 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 ;-)
  8. 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.
  9. 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_nam
  10. 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_tm
  11. 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
  12. 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='{$_SESSIO
  13. 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"><s
  14. 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?
  15. 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"&
  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 = mys
  17. 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 upl
  18. 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.
  19. 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.
  20. I have uploaded the specific image of the student in xampp/htdocs/a/images and i want to display it specifically on their profile given their unique id. I really think there is something missing in my codes maybe the path but i just dont know how to express it. Please advise Note: "images" is a folder where all the image of the students are saved.
×
×
  • Create New...