-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.php
41 lines (39 loc) · 1.1 KB
/
profile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<html>
<body>
<?php
$host="localhost";
$user="root";
$pass="root@123";
echo "getting ready";
$con = mysqli_connect("$host","$user","$pass");
if($con)
{ //echo 'connection done';
mysqli_select_db($con,'test');
$uname=$_POST['user'];
$first=$_POST['first'];
$last=$_POST['last'];
//$dob=$_POST['date'];
//$gender=$POST["gender"];
$filetmp=$_FILES["image"]["tmp_name"];
$filename=$_FILES["image"]["name"];
$filetype=$_FILES["image"]["type"];
$filepath="pictures/".$filename;
move_uploaded_file($filetmp,$filepath);
//echo" upload done";
$query="INSERT INTO profile(user,img_name,img_path,img_type) VALUES ('$uname','$filename','$filepath','$filetype')";
$result=mysqli_query($con,$query);
// echo" inserted";
$query="Select * from profile where user='$uname'";
$result=mysqli_query($con,$query);
while($row=mysqli_fetch_array($result))
{
echo " <img src='pictures/".$row['img_name']."' width='400' height='200' />";
}
mysqli_close($con);
}
else
{echo "connetion not done";
}
?>
</body>
</html>