Database SQL Error, Should Work
Not sure about DB connection but there seems some syntax issue. lat and lng have been used unlike PHP variables at some places in your code. I believe, they should have been $lat and $lng respectively instead.
Not sure about DB connection but there seems some syntax issue. lat and lng have been used unlike PHP variables at some places in your code. I believe, they should have been $lat and $lng respectively instead.
wpdb->update update the entire table instead of one row
This is a little hard to tinker with, without data to try it on. What strikes me as strange in your architecture that you describe it as type with three possible values, but what you have it three (I guess) different keys for it. It would make more sense to me if you had single … Read more
Since version 4, you can order by multiple fields via an array: ‘orderby’ => array( ‘meta_value_num’ => ‘ASC’, ‘date’ => ‘DESC’ )
You do not need to use quotes around some data types in SQL, integers being one of those types. That is why the first block of code works. It is a perfectly valid SQL statement. You do need to quote strings in SQL. That is why your second block of code does not work. The … Read more
I solve it. public function insertionRow($id){ global $wpdb; $wpdb->query(“INSERT INTO wp_choix_attributs_liste (att_id) VALUES (“.$id.”);”); } In my html with the checkbox. if(isset($_POST[‘sub’])) { foreach ($_POST[‘choixP’] as $id) { self::insertionRow($id); } }
Short Answer To get the post status, you’ll need to JOIN the posts table based on the post_id you grabbed from wpm1 or wpm2 and extend your WHERE clause to use that joined data. Recommendation On the other hand, instead of going directly to the database to get your content, you could use WP_Query to … Read more
You can try the following: AND ($wpdb->postmeta.meta_key = ‘cc_price’ AND $wpdb->postmeta.meta_value LIKE ‘%$s_prc%’) (Use cc_price instead of $cc_price)
I think you could simplify this a lot by using the pre_get_users hook, instead of working directly with the complicated SQL within the pre_user_query hook. Try something like: add_action( ‘pre_get_users’, function( \WP_User_Query $q ) { $qv = &$q->query_vars; if( isset( $qv[‘orderby’] ) && ‘test_date’ === $qv[‘orderby’] ) { // Custom meta query $qv[‘meta_query’] = [ … Read more
I am not good at SQL but I believe this SQL query will do the job for you. UPDATE wp_posts SET post_status=”publish” WHERE post_type=”product” AND post_status=”trash”; Please remember to change WP database prefix if it is not default wp.