Jump to content

Recommended Posts

I have created the following function:

function get_prepress_checked_items($job_number){

        $checked_items=array();

        $sql='SELECT * from rs_prepress_log where job_number='.sprintf('%d',$job_number);

        $query=$this->db->query($sql);

        $query->result_array(); 

        //$rtn=$query->result(); #returns the results from the log file   

      // $checked_items=array();

        foreach($query->result_array() as $row)

        {

        $checked_items[]=$row['item_checked'];

        $checked_items[]=$row['item_comment'];

           

        }

 

        return $checked_items;

    }

when I execute the following code

echo '<pre>';var_dump($checked_items);echo '</pre>';

 

I get back:

array(4) {

  [0]=>

  string(3) "A00"

  [1]=>

  string(9) "comment 1"

  [2]=>

  string(3) "A20"

  [3]=>

  string(9) "comment 2"

}

My question is how do I set up a loop to get the "comment 1" and "comment 2" variables? ;D

Link to comment
https://forums.phpfreaks.com/topic/153329-access-values-in-an-array/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.