WordPress.org

Support

Support » How-To and Troubleshooting » $wpdb->get_results returns only one row

$wpdb->get_results returns only one row

  • lightdesign100

    @lightdesign100

    Hi.
    I’m totally confused.
    I run 2 the same queries, one with $wpdb, the other via mysql_query (also checked via phpmyadmin)
    First query returns ONLY ONE row:
    $wpdb->get_results("SELECT * FROM wp_terms WHERE slug LIKE '%info%' ORDER BY name ASC");

    mysl_query returns 42 rows. The same result if run the query via phpmyadmin.

    $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
      mysql_selectdb(DB_NAME,$con);
      $res=mysql_query("SELECT * FROM wp_terms WHERE slug LIKE  '%info%' ORDER BY name ASC",$con);
      while($obj=mysql_fetch_object($res)) {
        var_dump($obj);
      }

    How can it be ??

    $wpdb->show_errors();
    $wpdb->print_error();

    show no errors.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘$wpdb->get_results returns only one row’ is closed to new replies.
Skip to toolbar