Fatal error: Can't use function return value in write context
I have a problem with my code which I will put below on line 22, can you help me?
<?php
if(empty($_POST['code'])){header("Location:exemple15.8.php");}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>Modifiez vos coordonnées</title>
</head>
<body>
<?php
include('exemple15.2.php');
$idcom=connexobjet('magasin','myparam');
if(!isset($_POST['modif']))
{
$code=$idcom->escape_string($_POST['code']);
// Requête SQL
$requete="SELECT * FROM client WHERE id_client='$code'";
$result=$idcom->query($requete);
echo "<form>";
while($data=mysqli_fetch_array($requete)){
echo "<fielset>";
echo"<table>";
echo "<p>$code - $nom - $prenom - $age - $adresse - $ville - $mail</P>";
}
echo "</table>";
echo"</fieldset>";
echo "</form>";
//$result->free();
$idcom->close();
// Création du formulaire complété avec les données existantes ←
}
elseif(isset($_POST['nom'])&& isset($_POST['adresse'])&& isset($_POST['ville']))
{
// ENREGISTREMENT
$nom=$idcom->real_escape_string($_POST['nom']);
$adresse=$idcom->real_escape_string($_POST['adresse']);
$ville=$idcom->real_escape_string($_POST['ville']);
$mail=$idcom->real_escape_string($_POST['mail']);
$age=(integer)$_POST['age'];
$code=$idcom->real_escape_string($_POST['code']);
// Requête SQL
$requete="UPDATE client SET nom='$nom', adresse=
'$adresse',ville='$ville',mail='$mail',age=$age WHERE id_client='$code'";
$result=$idcom->query($requete);
if(!$result)
{
echo "<script type=\"text/javascript\"> alert('Erreur : ".$result->error."')
</script>";
}else
{
echo "<script type=\"text/javascript\"> alert('Vos modifications sont
enregistrées');window.location='exemple15.8.php';</script>";
}
$result->free();
$idcom->close();
}else
{
echo "Modifiez vos coordonnées !";
}
?>
</body>
</html>
Subject
Written By
Posted
Fatal error: Can't use function return value in write context
August 30, 2021 10:22AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.