WordPress.org

Ready to get started?Download WordPress

Forums

Access to WordPress 3 database (4 posts)

  1. bjarneh
    Member
    Posted 2 years ago #

    In Joomla an access to database could be:
    function getSats() {
    $db = JFactory::getDBO();
    $sql = "SELECT * FROM jos_alphajob_sats";
    $db->setQuery($sql);
    $data = $db->loadObjectList();
    return($data);
    }
    How is the code in WordPress?

    Yours
    Bjarne

  2. esmi
    Forum Moderator
    Posted 2 years ago #

  3. bjarneh
    Member
    Posted 2 years ago #

    This code gives not the right result:

    global $wpdb;
    $myrows = $wpdb->get_results( "SELECT * FROM alphajob_sats" );

    I have a table (alphajob_sats) with 2 fields and 5 records, and I want $myrows = this data, but how?

    Please help!

  4. bjarneh
    Member
    Posted 2 years ago #

    I have a table (alphajob_sats) with 2 fields(columns) and 5 records(rows), and I want $myrows = this data, but how?

    In Joomla an access to database could be:
    function getSats() {
    $db = JFactory::getDBO();
    $sql = "SELECT * FROM jos_alphajob_sats";
    $db->setQuery($sql);
    $data = $db->loadObjectList();
    return($data);
    }
    How is the code in WordPress?

    This code are not giving the right result:

    global $wpdb;
    $myrows = $wpdb->get_results( "SELECT * FROM alphajob_sats" );

    Please help!

Topic Closed

This topic has been closed to new replies.

About this Topic