Welcome Guest, Not a member yet? Register   Sign In
modifying data in an array of result_array
#1

[eluser]Rodrigo Berlinck[/eluser]
Hello everybody,
I am not able to change the data in a result array, I need to use the strip_tags.

I'm doing the following:
Code:
$exemple_query = $this->db->query("SELECT * FROM MYDB" );


        $data = array(

            'exemple_name' => $example_query->result_array

        );

    

        $this->parser->parse('includes/template',$data);

I need to use the function in the title, but how do I change the variable inside the array and then use the load> parser?


thanks
#2

[eluser]vitoco[/eluser]
result_array() returns a multidimensional array, so you cannot get a value like you want to.

Code:
// EXECUTE THE QUERY
    $exemple_query = $this->db->query("SELECT * FROM MYDB" );
    // GET THE FIRST ROW
    $row = $exemple_query->row_array();
    // CREATE THE DATA ARRAY TO PASS IN THE VIEW
    $data = array(
        // GET THE APPROPRIATE INDEX OF THE ROW ARRAY ( 'title' i guess )
        'exemple_name' => $row['title'];
    );
    //
    $this->parser->parse('includes/template',$data);
#3

[eluser]Rodrigo Berlinck[/eluser]
Perfect, Thanks for yout help!




Theme © iAndrew 2016 - Forum software by © MyBB