Welcome Guest, Not a member yet? Register   Sign In
blank page bug
#1

[eluser]danushka[/eluser]
Hi CodeIgniters !,

I was developing an application until i created a new function in a model i was developing and when i called that model function in the Controller , suddenly i get a blank page. I don't even see the HTML HEAD and BODY tages in the page source. Can you help me to debug this ?

cheers

Dan
#2

[eluser]bretticus[/eluser]
Blank pages in PHP means an error. You can enable error messages. See this post.
#3

[eluser]cahva[/eluser]
You probably have display_errors set to Off so the error you're having should be in you http-error_log.
To get it shown to browser, you can edit .htaccess(or add .htaccess file if not using it) file and add this line to it:
Quote:php_flag display_errors 1
#4

[eluser]danushka[/eluser]
[quote author="bretticus" date="1273340413"]Blank pages in PHP means an error. You can enable error messages. See this post.[/quote]


Hey , Thanks for the quick response.

When i comment that model function calling line . i get the expected output ( the template output ). but when i call that line by removing the comment , i get the blank page. i double checked the calling function and it has none any kind of errors. This is a well known function from a well known CI book.

Here it is.

function getMainFeature()
{
$data = array();
$this->db->select('id,name,shortdesc,image');
$this->db->where('featured','true');
$this->db->where('status','active');
$this->db->orderby("rand()");
$this->db->limit(1);
$Q = $this->db->get('products');

if($Q->num_rows() > 0)
{
foreach($Q->result_array() as $row)
{
$data = array
(
"id"=>$row['id'],
"name"=>$row['name'],
"shortdesc"=>$row['shortdesc'],
"image"=>$row['image']
);
}

}

$Q->free_result();
return $data;
}

so is this something to do with CI's database class or database driver causing this blank page bug ?
#5

[eluser]danushka[/eluser]
[quote author="bretticus" date="1273340413"]Blank pages in PHP means an error. You can enable error messages. See this post.[/quote]

Hey Thanks ,

i had display_errors set as off in php.ini , i set it on and now i can find a way to debug

Thanks others for quick responses and tips.

You guys ROCK !




Theme © iAndrew 2016 - Forum software by © MyBB