require_once ‘../../../wp-load.php’;
function insertDB($name,$contact,$email,$evtName) {
global $wpdb;
$wpdb->custom_table = “custom_table_name”;
//$wpdb->show_errors();
$ok = $wpdb->insert($wpdb->custom_table, array(
‘name’ => $name,
‘contact’ => $contact,
‘email’ => $email,
‘event_name’ => $evtName
));
if ($ok) {
echo json_encode(array( ‘ok’ => true , ‘status’ => ‘success in DB insert’ ));
}else {
//$wpdb->print_error();
echo json_encode(array( ‘ok’ => false , ‘status’ => ‘failed on DB insert’ ));
}
}
insertDB($name,$contact,$email,$evtName);
Advertisement



September 23rd, 2011 at 2:36 pm
Thank you for the site, excellent information