我有一张桌子
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
和一个数组:
Array
(
[percentile] => 99
[FoSW] => 125
[DfLR] => 110
[FoA] => 60
[SoG] => 120
[RST] => 40
[SSW] => 45
[total] => 500
)
而且这段代码由于某种原因不起作用...... Catch 不会引发错误。只是我的 if 语句回显错误...
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;
}
}