$ wpdb->更新无效

时间:2013-09-22 23:16:35

标签: php database wordpress wpdb

该表未更新,我无法弄清楚原因。

<?php 
session_start();
$fn_prev = $_SESSION['prev_fn'];
$sn_prev = $_SESSION['prev_sn'];
$m_prev = $_SESSION['prev_m'];
$d_prev = $_SESSION['prev_d'];
$num_prev = $_SESSION['prev_num'];
$em_prev = $_SESSION['prev_em'];

echo "Old Firstname".$fn_prev. "\n";
echo "Fisrtname".$_POST['Firstname']. "\n";
global $wpdb;

try{
$wpdb->update( 
    'church', 
    array( 
        'Firstname' => $_POST["Firstname"], 
        'Surname' => $_POST["Surname"], 
        'Month' => $_POST["Month"], 
        'Day' => $_POST["Day"], 
        'Email' => $_POST["Email"], 
        'Number' => $_POST["Number"]
        ), 
    array(  
            'Firstname' => $fn_prev,
            'Surname' => $sn_prev,
            'Month' => $m_prev,
            'Day' => $d_prev,
            'Email' => $em_prev,
            'Number' => $num_prev 
        )
);

echo "Done.";
}catch(Exception  $e){
echo 'Caught exception: ',  $e->getMessage(), "\n";
}
?>

0 个答案:

没有答案