$wpdb The query does not contain the correct number of placeholders
$wpdb The query does not contain the correct number of placeholders
$wpdb The query does not contain the correct number of placeholders
This doesn’t have anything to do with WordPress, just some PHP code to get what you’re after. You need to convert MySQL datetime to Unix time by using: $timestamp = strtotime($psm_mod_datetime); Then you output this timestamp in the format you desire by using: echo “Updated: “.date(‘d F Y’, $timestamp);
You must specify values for column_offset and row_offset. For example: <?php $wpdb->get_var( null, 5, 0 ); ?> Will return “Hello World” (see attached image) But for that to work you had to have a previous query like this: <?php $wpdb->get_var( “SELECT * FROM $wpdb->posts” ); ?>
I’m not allowed to comment to ask for more information but try putting global $wpdb; on the line after the public function fetch($tableName,$where=””,$orderField=””,$groupByField=””,$sqlAddon=””){ line
Perhaps info on this page might help: http://codex.wordpress.org/Class_Reference/wpdb Other than that I would do the usual troubleshooting to start. Backup everything. Turn off all plugins. Switch to a standard WordPress theme like 2015. Then see what errors you are getting now that you have stripped down your install. Then slowly turn things back on until … Read more
It looks like your SQL succeeded to me. So I guess your problem is that you’re getting an array of results (which is probably an array of arrays: rows, then columns per row) when you were expecting a single scalar value. Try using get_var() to get a single value from the database: $DBPresults = $wpdb->get_var( … Read more
For 1st question $args = array( ‘post_type’ => ‘us_visa’, ‘posts_per_page’ => -1, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘meta_query’ => array( array( ‘key’ => ‘_Passport’, ‘value’ => $passport_num, ) ) ); $query = new WP_Query( $args ); See Custom Field Parameters of WP_Query on Codex For 2nd question, inside the loop use <?php the_terms( get_the_ID(), … Read more
First of all, you escape that query incorrectly… You should use esc_like on the like part and prepare should be used a little bit different: $title1 = ‘Gocomma 10W QI Wireless Fast Charger Car Mount Holder – 2pcs (it)’; $sql = $wpdb->prepare( “SELECT * FROM {$wpdb->posts} WHERE post_title LIKE %s AND post_status=”publish””, ‘%’ . $wpdb->esc_like($title1) … Read more
You can try the following query SELECT * FROM `mytable` WHERE `question` = ‘\\\”creating world \\\” written by\?’ In php global $wpdb; $quest=addcslashes(‘\”creating world \” written by?’,’\”?’); $result = $wpdb->get_results(“SELECT * FROM mytable WHERE question ='{$quest}'”);
Glancing at your code I see a few potential problems. According to this Codex page dbDelta is “picky”; You must put each field on its own line in your SQL statement. You must have two spaces between the words PRIMARY KEY and the definition of your primary key. You must use the key word KEY … Read more