WordPress.org

Ready to get started?Download WordPress

Forums

$wpdb->get_results returns only one row (2 posts)

  1. lightdesign100
    Member
    Posted 1 year ago #

    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.

  2. nalonsor
    Member
    Posted 1 year ago #

    in your query only add "LIMIT 1"

    http://forums.mysql.com/read.php?136,154285,154285

Topic Closed

This topic has been closed to new replies.

About this Topic