Professional Documents
Culture Documents
php
include_once 'database.php';
$edit=$_GET['id'];
$select="select * from student where id='$edit'";
$run=mysqli_query($con,$select);
$row=mysqli_fetch_array($run);
$id=$row['id'];
$name=$row['name'];
$gender=$row['gender'];
$a=$row['hobby'];
$hobby=explode(',',($a));
$course=$row['course'];
$college=$row['college'];
$contact=$row['contact'];
$image=$row['image'];
?>
<html>
<head>
<title>Student Record Update</title>
</head>
<body>
<?php
if(isset($_POST['update'])){
$up_id=$_GET['id'];
$name_u=$_POST['name'];
$gender_u=$_POST['gender'];
$b=$_POST['hobby'];
$hobby_u=implode(',',($b));
$course_u=$_POST['course'];
$college_u=$_POST['college'];
$contact_u=$_POST['contact'];
if(isset($_FILES['image']['name'])&&($_FILES['image']['name']!=""))
{
$file_name=$_FILES['image']['name'];
$file_size=$_FILES['image']['size'];
$file_tmp=$_FILES['image']['tmp_name'];
$file_type=$_FILES['image']['type'];
unlink("image,$old_image");
move_uploaded_file($file_tmp,"upload/".$file_name);
}
else{
$file_name=$old_image;
}
$run_u=mysqli_query($con,$update);
if($run_u){
else{
}
}
?>