我有一个库存表,我在其中存储有关库存的信息,如笔记本电脑。我在库中存储库存的图像路径,如photo / laptop.jpg。现在在数据库中插入数据后,我想进行更改,如更改笔记本电脑图像。为了进行更改,我首先通过搜索数据上的唯一笔记本电脑名称进行搜索,然后从数据库中检索,但无法获取图像详细信息 我正在尝试以下PHP代码
<html>
<head>
<?php
include 'dbconfig.php';
include 'functions.php';
$fname="";
$lname="";
$age="";
$email="";
function getPosts()
{
$posts = array();
$posts[0] = $_POST['fname'];
$posts[1] = $_POST['lname'];
$posts[2] = $_POST['age'];
$posts[3] = $_POST['email'];
return $posts;
}
if(isset($_POST['search']))
{
$data = getposts();
$result = mysqli_query($conn,"SELECT * FROM info
WHERE fname='$data[0]'");
if($result)
{
if(mysqli_num_rows($result))
{
while($row = mysqli_fetch_array($result))
{
$fname = $row['fname'];
$lname = $row['lname'];
$age = $row['age'];
$email = $row['email'];
//here i need image to be retrieve from database
}
}else{
echo 'no data found';
}
}else{
echo 'result error';
}
}