我在通过我的插件将数据插入 WordPress 数据库时遇到问题。
我的插件使用短代码来显示一个表单,从中进行一些计算,然后该信息应该被插入到数据库中,但我最终收到了此消息。
我似乎无法让它工作?..任何帮助将不胜感激。
用于插入的插件代码:
include_once($_SERVER['DOCUMENT_ROOT'].'/wp-config.php' );
$wpdb->insert(
'wp_wine_bookings',
array(
'name' => $_POST['name'],
'last_name' => $_POST['lname'],
'phone_number' => $_POST['phone_num'],
'email' => $_POST['email'],
'booking_status' => "Booked",
'tour_name' => $_POST['tourname'],
'tour_date' => $_POST['tourdates'],
'number_of_people' => $_POST['num_ppl'],
'price' => $_POST['priceget'],
'state' => $_POST['state'],
'city' => $_POST['city'],
'country' => $_POST['country'],
'mobile' => $_POST['mobile'],
'preffered_pickup_point' => $_POST['locationpickup'],
'arrival_date' => $_POST['arrivaldate'],
'name_on_credit_card' => $_POST['cn'],
'credit_card_type' => $_POST['type'],
'payment_date' => date("d-m-y"),
'occasion' => $_POST['occasion'],
'requirementsO' => $_POST['requirementsO'],
'requirementsP' => $_POST['requirementsP']
),
array(
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s'
)
);
PHP 错误:
致命错误:在非对象上调用成员函数 insert()
/home/user/public_html/wp-content/plugins/BookingWT/booknow.php
52号线