Support » Fixing WordPress » Access to WordPress 3 database

  • bjarneh

    (@bjarneh)


    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

Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi

    (@esmi)

    Forum Moderator

    bjarneh

    (@bjarneh)

    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!

    bjarneh

    (@bjarneh)

    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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Access to WordPress 3 database’ is closed to new replies.