0

This appears mensagem: Severity: Notice Message: Array to string conversion

my model

public function get_parcelasvencidas()
{
    $today = date('Y-m-d');
    $id = $this->session->userdata('user_id');
    $query = $this->db->query("SELECT * FROM parcelas, aluguel WHERE id_aquiler_parcelas = id_alug");
    return $query->result();
}
1
  • For all we know, your comma-JOINed tables are correctly related by the columns in the WHERE clause. We need a minimal reproducible example and better Debugging Details. Commented Jul 10 at 13:45

2 Answers 2

1

First of all, your query is seems wrong. Change with this :

$this->db->query("SELECT * FROM parcelas, aluguel WHERE id_aquiler_parcelas = 'id_alug'");

Because id_alug is value, not variable.

Second, you get an error like this :

Message: Array to string conversion

Because your return type in model is an object. To get the result use foreach instead, like this :

foreach($this->my_model->get_parcelasvencidas() as $row)
{
    echo $row->id;
    echo $row->name;
}
Sign up to request clarification or add additional context in comments.

Comments

1

Only one little change is,

$this->db->query("SELECT * FROM parcelas, aluguel WHERE id_aquiler_parcelas = 'id_alug'");

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.