CodeIgniter Forums

Full Version: Array to string conversion
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!

I have little problem with my script. I getting error:
PHP Code:
SeverityNotice

Message
: Array to string conversion

Filename
V_panel/wydarzenia.php

Line Number
56 

Here is full script:
PHP Code:
function pobierz_wpisy_kalendarza$rok$miesiac )
 {
 
 
$query $this->db->select'date''data' )
 
 ->from'kalendarz' )
 
 ->like'date'"$rok-$miesiac"'after' )
 
 ->get();

 
$wpisy = array();

 foreach ( 
$query->result() as $row ) {
 
$wpisy[substr($row->date,8,2)] = $row->data;
 }

 return 
$wpisy;

 } 

This is bad line:
PHP Code:
<?php echo $wpisy?>
so this is only echo for variable, so something is wrong in model (UP).
PHP basics you CAN'T echo array...
Use print_r($wispy); instead..
So i getting now:
PHP Code:
Array ( ) 
It seems that there are no results to your query.

Log your query with $this->db->last_query();
you can add it to $wispy['query']= $this->db->last_query(); After you have runned the select..

And see what is the generated query ..
... $this->db->select( 'date, data' ) ...