-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction.php
36 lines (31 loc) · 889 Bytes
/
function.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
<?php
function upload_image()
{
if(isset($_FILES["product_image"]))
{
$extension = explode('.', $_FILES['product_image']['name']);
$new_name = rand() . '.' . $extension[1];
$destination = 'assets/Images/' . $new_name;
move_uploaded_file($_FILES['product_image']['tmp_name'], $destination);
return $new_name;
}
}
function get_image_name($product_id)
{
include('session.php');
$statement = $conn->prepare("SELECT product_image FROM producttb WHERE product_name = '$product_id'");
$statement->execute();
$result = $statement->fetchAll();
foreach($result as $row)
{
return $row["product_image"];
}
}
function get_total_all_records($conn, $user_id)
{
$statement = $conn->prepare("SELECT * FROM producttb WHERE user_id = :user_id");
$statement->bindValue(':user_id', $user_id, PDO::PARAM_INT);
$statement->execute();
return $statement->rowCount();
}
?>