I have been trying to create an edit link for my web application. the update request doesn't work and oddly I am not getting any error. any ideas please .Thanks in advance
Here is my code:
<?php
$id=$_GET["invistID"];
if(isset($_POST['validation']))// the submit buttom
{
try
{
$req = $bdd->prepare('UPDATE invistigation_en SET fininvist=:fininvist,rapportinvist=:rapportinvist,status=:status WHERE invistID=:invistID');
$data =array(
':invistID'=>$id,
':fininvist'=> $_POST['fin'],
':rapportinvist'=> $_POST['rapport'],
':status'=> $_POST['status']
);
$req->execute($data);
echo "success ...";
}catch(PDOException $e){
echo "Error ... :".$e->getMessage();
}
header('Location:invistigation.php');//
}
?>
Debug is an important step when you build applications. When you write code, some times, application behavior is not as you expects. This is your case. At this time, you should isolate your issue and fix it.
To isolate issue they are some techniques. At this time you don't know why this code don't run. Then you should identify program check points and check if, at this points, all is as you expect.
For your code:
var_dump( $_POST )
execute
are right: var_dump( $data )
var_dump($bdd->ErrorInfo())
var_dump($req->ErrorInfo())
.Update
word by XXXX
, execute and check if some errors appear.die("end")
to see all page errors.good luck, and please, let us know, finally, where your error was.