gpt4 book ai didi

php - 未捕获的 ArgumentCountError:函数 wpdb::prepare():update 的参数太少

转载 作者:行者123 更新时间:2023-11-29 16:59:32 25 4
gpt4 key购买 nike

我收到以下错误:

Fatal error: Uncaught ArgumentCountError: Too few arguments to function wpdb::prepare(), 1 passed in /homepages/39/d740877019/htdocs/test/wp-content/themes/eduma/formulaire_get.php on line 108 and exactly 2 expected in /homepages/39/d740877019/htdocs/test/wp-includes/wp-db.php:1222 Stack trace: #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} thrown in /homepages/39/d740877019/htdocs/test/wp-includes/wp-db.php on line 1222

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

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

最佳答案

我解决了我的问题:

$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'));

关于php - 未捕获的 ArgumentCountError:函数 wpdb::prepare():update 的参数太少,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52372384/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com