我已经通过metabox创建了一个表单,并将数据保存在自定义表中
我的桌子是:
$table_name = $wpdb->prefix . \'aacv\';
$sql = "CREATE TABLE $table_name (
id int(11) NOT NULL AUTO_INCREMENT,
user_id int(20) Not Null,
name varchar(255) collate utf8_unicode_ci NOT NULL,
lastname varchar(255) collate utf8_unicode_ci NOT NULL,
post_title varchar(255) collate utf8_unicode_ci NOT NULL,
food_selected varchar(255) collate utf8_unicode_ci NOT NULL,
guest_number bigint(20) NOT NULL,
email varchar(255) NOT NULL,
PRIMARY KEY (Id)
);";
我想通过以下代码获取类似帖子标题的条目:
<?php $abcde = $abc = the_title();
$mylink = $wpdb->get_results(\'SELECT * FROM wp_aacv WHERE post_title LIKE\' .$abcde); ?>
<?php foreach ($mylink as $post){ ?>
<?php echo $post->food_selected;} ?>
但不起作用。