Uncaught ArgumentCountError:函数wpdb :: prepare():update的参数太少

时间:2018-09-17 16:47:20

标签: php mysql wordpress

我遇到以下错误:

  

致命错误:未捕获的ArgumentCountError:的参数太少   函数wpdb :: prepare(),传入1   /homepages/39/d740877019/htdocs/test/wp-content/themes/eduma/formulaire_get.php   在第108行,正好在2个   /homepages/39/d740877019/htdocs/test/wp-includes/wp-db.php:1222堆栈   跟踪:#0   /homepages/39/d740877019/htdocs/test/wp-content/themes/eduma/formulaire_get.php(108):   wpdb-> prepare('UPDATE wp_pmpro ...')#1   /homepages/39/d740877019/htdocs/test/wp-includes/template.php(688):   require_once('/ homepages / 39 / d ...')#2   /homepages/39/d740877019/htdocs/test/wp-content/themes/eduma/wrapper.php(14):   load_template('/ homepages / 39 / d ...')#3   /homepages/39/d740877019/htdocs/test/wp-includes/template-loader.php(74):   include('/ homepages / 39 / d ...')#4   /homepages/39/d740877019/htdocs/test/wp-blog-header.php(19):   require_once('/ homepages / 39 / d ...')#5   /homepages/39/d740877019/htdocs/test/index.php(17):   require('/ homepages / 39 / d ...')#6 {main}被抛出   /homepages/39/d740877019/htdocs/test/wp-includes/wp-db.php在线   1222

有问题的行是下面的第二行:

@Component    
public class CommandLineAppStartupRunner implements CommandLineRunner {
    @Autowired
    UserRepository userRepository;

    @Override
    public void run(String...args) throws Exception {
        User admin = new user(firstName);
        userRepository.save(admin);
    }
}

1 个答案:

答案 0 :(得分:0)

我解决了我的问题:

$current_price = (($ecoles * $classes)/10)*28 ; 
$wpdb->query($wpdb->prepare("UPDATE wp_pmpro_membership_levels 
                SET initial_payment='%s' 
                WHERE name = %s",$current_price,'mairie'));