I have a table
percentile int(3) No
FoSW int(3) Yes NULL
dfLR int(3) Yes NULL
FoA int(3) Yes NULL
SoG int(3) Yes NULL
RST int(3) Yes NULL
SSW int(3) Yes NULL
total int(3) No
and an array:
Array
(
[percentile] => 99
[FoSW] => 125
[DfLR] => 110
[FoA] => 60
[SoG] => 120
[RST] => 40
[SSW] => 45
[total] => 500
)
And this code that does not work for some reason... Catch does not throw an error. Just my if statement which echos error...
if ($_POST['percent']=='add'){
try{
$post = $_POST;
unset($post['percent']);
$sth = $dbh->prepare("INSERT INTO percentiles (percentile, FoSW, dfLR, FoA, SoG, RST, SSW, total) VALUES (?,?,?,?,?,?,?,?)");
if ($sth->execute($post)){
echo 'done<br/>';
}
else echo 'error';
}
catch(PDOException $e){
echo 'error'.$e;
}
}