PHP Help:-

How to update image ?

Using Code:-

<?php

include_once("database.php");

if(count($_POST)>0) 

   {

         

// $sql="UPDATE users SET name='" . $_POST['name'] .  "', dateofbirth='" . $_POST['dateofbirth'] . "' ,email='" . $_POST['email'] . "' WHERE userid='" . $_GET['userid'] . "'";

$sql="UPDATE users SET name='" . $_POST['name'] . "' ,email='" . $_POST['email'] . "' WHERE userid='" . $_GET['userid'] . "'";

echo $sql;

exit;

mysqli_query($conn,$sql);

$message = "Record Modified Successfully";

header("location:show.php");

}

$result = mysqli_query($conn,"SELECT * FROM users WHERE userid='" . $_GET['userid'] . "'"); // For Fetch...

$row= mysqli_fetch_array($result);

?>

<html>

<head>

<title>Update Employee Data</title>

</head>

<body>

<form name="frmUser" method="post" action="" style="margin-left:230px;margin-top:85px;" enctype="multipart/form-data">

<div><?php if(isset($message)) { echo $message; } ?>

</div>

<div style="padding-bottom:5px;margin-bottom:20px;">

<a href="show.php">Users List</a>

</div>

Name: <br>

<input type="text" name="name" class="txtField" value="<?php echo $row['name']; ?>">

<br>

<br>

<!-- Date Of Birth :<br>

<input type="date" name="dateofbirth" class="txtField" value=""> -->

<br>

<br>

Email:<br>

<input type="email" name="email" class="txtField" value="<?php echo $row['email']; ?>">

<br>

<br>

<input type="submit" name="submit" value="Update" class="buttom">

</form>

</body>

</html>

There isn’t an image mentioned in this code. What are you trying to do?

First start with a basic tutorial:

example: https://www.w3schools.com/php/php_file_upload.asp

Then come back with any issues/errors/questions…

As @skawid mentions… there is no ‘image’ related code in your example.

Sponsor our Newsletter | Privacy Policy | Terms of Service