-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsertImage.php
More file actions
33 lines (23 loc) · 830 Bytes
/
insertImage.php
File metadata and controls
33 lines (23 loc) · 830 Bytes
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
<?php
session_start();
include "profile.php";
if($_SERVER['REQUEST_METHOD']=='POST'){
$email=$_SESSION['email'];
$image = $_FILES['image']['tmp_name'];
$img = file_get_contents($image);
$con = mysqli_connect('localhost','root','','raghav') or die('Unable To connect');
$sql = "insert into loveeconnect (image) values(?) where email='$email' ";
$stmt = mysqli_prepare($con,$sql);
//mysqli_stmt_bind_param($stmt, "s",$img);
//mysqli_stmt_execute($stmt);
$check = mysqli_stmt_affected_rows($stmt);
if($check==1){
header('Location: profile.php?success');
}else{
echo "<script>Error: </script>" . $sql . "<script><br></script>" . $conn->error;
header('Location: profile.php?failure');
}
mysqli_close($con);
}else{
header('Location: profile.php');
}