ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Query Module SQL results into php array?

August 14, 2010 9:22pm

Subscribe [1]
  • #1 / Aug 14, 2010 9:22pm

    HotLimbo

    67 posts

    I pull rows of data from a table using the query module. Works fine and returns everything I want.

    Is there a way I can pipe those rows into a php array though? There are four returned values per row.

  • #2 / Aug 15, 2010 11:45am

    ender

    1644 posts

    easier to just use the database class directly to do the query in PHP:

    in EE2 it’d look something like this:

    <?php
        $result = $this->EE->db->query("SELECT ...");
        if($result->num_rows() > 0) {
            foreach($result->result_array() as $row) {
                ...
            }
        }
    ?>
  • #3 / Aug 15, 2010 2:28pm

    HotLimbo

    67 posts

    Thanks, once again! You are a star.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases