Wordpress queries the database get_var for non-existent records and reports a fatal error. How to set it to only return null without reporting an error?
一直走
一直走 2022-01-30 10:35:31
0
0
872

// $rs = $wpdb->get_var($wpdb->prepare("SELECT * FROM $table WHERE number = $number"));

$rs = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table "));

报下面的错

Fatal error: Uncaught Error: Call to a member function get_var() on null in D:\phpStudy22\WWW\wordpress5.9\wp-content\themes\lsm2022\from.php:23 Stack trace: #0 {main} thrown in D:\phpStudy22\WWW\wordpress5.9\wp-content\themes\lsm2022\from.php on line 23

一直走
一直走

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template