WordPress.org

Ready to get started?Download WordPress

Forums

get_row and Select all (1 post)

  1. jaspol@hotmail.com
    Member
    Posted 1 year ago #

    I have a SQL statement that works like this:

    $qnm = $wpdb->get_row($wpdb->prepare("SELECT col1,col2 FROM ml_table WHERE col3 = $somevariable"));
    I return results like $qnm->col1 and get a value

    But it does NOT work like this:

    $qnm = $wpdb->get_row($wpdb->prepare("SELECT * FROM ml_table WHERE col3 = $somevariable"));
    I return results like $qnm->col1 and do NOT get a value

    Why does the Select specific columns work, but Select * does not? I've tried reading through documentation but can't find anything. Thanks in advance!

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by jaspol@hotmail.com
  • This topic is not resolved
  • WordPress version: 3.4.2