WordPress primitive query returns = array

i am trying to primitive query form this wp_query:

$  query_v = array(     'post_type' => array('pro'),     'posts_per_page'    => -1,     'orderby' => $  count_visit,     'order' => 'ASC',     'tax_query' => array(         array(             'taxonomy' => 'servizi_pro',             'field' => 'slug',             'terms' => $  art_p,             'parent' => 0         )     ) ); 

the problem with this wp_query is that it does not sort me by the number of post views counter that I downloaded as an additional plugin, and I am trying to implement in a primita wordpress query, the wp_query with the addition of the instructions to display the type of custom posts based on the number of views:

<?php global $  wpdb; $  cpt = "pro";  $  q = $  wpdb->get_results(     $  wpdb->prepare(" SELECT * FROM {$  wpdb->prefix}term_relationships  LEFT JOIN {$  wpdb->prefix}terms ON {$  wpdb->prefix}term_relationships.term_taxonomy_id = {$  wpdb->prefix}terms.term_id  LEFT JOIN term_taxonomy ON {$  wpdb->prefix}term_relationships.term_taxonomy_id = {$  wpdb->prefix}term_taxonomy.term_id  LEFT JOIN {$  wpdb->prefix}posts  ON {$  wpdb->prefix}term_relationships.object_id = {$  wpdb->prefix}posts.ID  LEFT JOIN post_views ON {$  wpdb->prefix}term_relationships.object_id = {$  wpdb->prefix}post_views.id  WHERE  {$  wpdb->prefix}post_views.type = '4'    AND {$  wpdb->prefix}posts.post_type = '$  cpt'  AND  {$  wpdb->prefix}terms.name = '$  art_p'         ") ); ?>  <?php print_r($  q);?> <?php foreach ($  q as $  r){ ?>     <?php echo "{$  r->post_title}"; ?> <?php } ?> 

but it always returns to me array (), where am I wrong?

How to prevent SQL Injection via the array parameter? (CVE-2017-14069)

Hello, this page suggest that the sql_query

$  r = sql_query("SELECT modcomment FROM users WHERE id IN (" . implode(", ", $  _POST[usernw]) . ")")or sqlerr(__FILE__, __LINE__);
Code (SQL):

is vulnerable to a SQL injection "via the usernw array parameter to nowarn.php."

and the exploit is suggested:

POST nowarned=nowarned&usernw[]=(select*from(select sleep(10))x)
Code (markup):

Please how that sql_query should…

How to prevent SQL Injection via the array parameter? (CVE-2017-14069)

How can I properly loop through an array gotten from my wordpress database and display it to my site

I am trying to display some posts information from my database on my live site. I have done the query correctly because I can view the items on the live site. But I need to take three items to display. The post title, the post content which houses the images, and the post id which links to the posts. I seem to have written it correctly but it does not do anything.

This is the code

<?php      global $  wpdb;                    $  results = $  wpdb->get_results( "SELECT * FROM $  wpdb->posts WHERE `post_type`='post' AND `post_status` = 'publish' LIMIT    20" );    foreach ($  results) {       echo "<div class="card">             <div class="img">              <img src="{post_content}" alt="">             </div>             <div class="info">                <h5>{post_title}</h5>             </div>           </div>";   }    //echo "<pre>";print_r($  results);echo"</pre>";                      ?>  

I am quite new to wordpress and PHP in general.

Time complexity of pairs in array double loop

I know, that the following is: O(n^2),

int count = 0; for(int i = 0; i<array.length(); i++) {    for(int j = i+1; j<array.length(); j++) {        if(array[i] == array[j]) {            count = count + 1;        }    } } 

But, should something like count = count + 1; be taken into account? For predicting or making up a complex time equation, or using sum notation,

n + n-1 + n-2 + n-3 + (…) + 1 

How to draw the heap for an array in Java?

I have an assignment to draw the heap after an ArrayList and a LinkedList is created.

public static void main(String[] args) {      List list = new ArrayList();      list.add(0);      list.add(1);      list.add(1);      list.add(2); } 

and

public static void main(String[] args) {      List list = new LinkedList();     list.add(0);      list.add(1);      list.add(1);      list.add(2); } 

So far I have a tree set up for [0, 1, 1, 2] so that it just goes down like a tree from 0, 1 and 1, then 2. But I don’t know if that’s correct and if it’d be different for the ArrayList and LinkedList.

How could a key could be inserted in a heap without increasing the size of an array?

MAX-HEAP-INSERT(A, key)     A.heap-size = A.heap-size + 1     A[A.heap-size] = -infinity     HEAP-INCREASE-KEY(A,A.heap-size,key) 

How could a key could be inserted in a heap without increasing the size of an array? With this code from Introduction To Algorithms, you can’t just randomly increase the heap size upon wish. Did I miss something? All all online lectures I have seen do no talk about this issue. Neither does the book touch this issue. Or is it that the lowest key in an array would be dropped automatically?

Selecting n elements from array in sublinear time using indices?

Are GPUs or CPUs capable of selecting n elements from an array in sublinear time using indices? If so, what would be some good alternatives to achieve this?

Lets say I have an array A = {1, 5, 6, 3, 6, 2} and indices I = {2, 5, 2, 4, 1, 0}. The resulting array should be: B = {6, 2, 6, 6, 5, 1}. The time complexity for this should be sublinear with respect to the length of I.

Finding the Time Complexity – Worst Case (Big-Θ) – Array List, BST

Hi I’m a bit confused on how to find the time complexity of the following in the worst case in terms of big-Θ, I’ve figured out 1 and 2.

What is the worst-case time complexity, in terms of big-Θ, of each of these operations: (1) insert an element in the array list = Θ(1) (2) remove an element from the array list (e.g. remove an occurrence of the number 5) = Θ(n)

(3) remove the second element from the array list (i.e. the one in position 1)

(4)count the number of unique elements it contains (i.e. the number of elements excluding duplicates; e.g.[6,4,1,4,3] has 4 unique elements)

Suppose you have an initially empty array list with an underlying array of length 10. What is the length of the underlying array after:

(5) inserting 10 elements in the array list (6) inserting 10 more elements in the array list (i.e. 20 elements in total) (7) inserting 10000 more elements in the array list (i.e. 10020 elements in total)

What is the worst-case time complexity, in terms of big-Θ, of each of these operations on binary search trees: (8) add an element in the tree (assuming that the tree is balanced) (9) add an element in the tree (without assuming that the tree is balanced) (10) find the largest element in the tree (assuming that the tree is balanced) After each operation, we should still have a valid heap.

Split a array with range conditions

I have an array like following:

    sortedransam={{0.105328, -0.0291632}, {0.253571, 0.00498561}, {0.410887,    0.171317}, {1.45579, 0.300952}, {2.56002, -0.0599007}, {3.67651,    0.0913857}, {4.44773, -0.21599}, {4.68098, 0.0766649}, {5.20004,    0.0153934}, {5.31011, 0.157674}, {6.25626, -0.119345}, {6.35928,    0.145992}, {6.52711, -0.0163245}, {7.44436, 0.0334628}, {7.8401,    0.305493}, {8.18541, 0.0712892}, {8.21423, -0.0325363}, {9.0921, -0.0242404}, {9.3285, 0.035512}} 

sortedransam‘s first colume has been sorted. I would like to split this array with conditions that the first column into range ex. 0-2, 2-4, 4-6… Then the sortedransam should be like

    {{{0.105328, -0.0291632}, {0.253571, 0.00498561}, {0.410887,    0.171317}, {1.45579, 0.300952}},   {{2.56002, -0.0599007}, {3.67651, 0.0913857}},   {{4.44773, -0.21599}, {4.68098, 0.0766649}, {5.20004, 0.0153934}, {5.31011, 0.157674}},   {{6.25626, -0.119345}, {6.35928, 0.145992}, {6.52711, -0.0163245}, {7.44436, 0.0334628},    {7.8401,0.305493}},   {{8.18541, 0.0712892}, {8.21423, -0.0325363}, {9.0921, -0.0242404}, {9.3285, 0.035512}}} 

Should I use SplitBy or something else? I don’t know how to get conditions implemented.