CodeIgniter Forums
[Help] Why is nothing to display when I set "$autoload['libraries'] = array('database');" in autoload.php ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: [Help] Why is nothing to display when I set "$autoload['libraries'] = array('database');" in autoload.php ? (/showthread.php?tid=2299)



[Help] Why is nothing to display when I set "$autoload['libraries'] = array('database');" in autoload.php ? - El Forum - 07-28-2007

[eluser]Luwian[/eluser]
Hiya,

I am a dub for the php and I just test the CI through the video tutorials.

I have a problem is that why my browser display nothing when I set
$autoload['libraries'] = array('database');
in autoload.php.

and if not to set it, there is a error message, which looks like
Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Testdb::$db

Filename: controllers/testdb.php

Line Number: 13


Thx


[Help] Why is nothing to display when I set "$autoload['libraries'] = array('database');" in autoload.php ? - El Forum - 07-28-2007

[eluser]bradym[/eluser]
Without seeing any code the things I would check are:

- Is your database connection info correct?
- Does the user specified in your db connection info have necessary db permissions?
- Are there any syntax errors that would cause a fatal error and a blank page on a setup where display_errors is set to Off in php.ini?

If you post the code that is causing problems, we may be able to help you better.

Brady


[Help] Why is nothing to display when I set "$autoload['libraries'] = array('database');" in autoload.php ? - El Forum - 07-29-2007

[eluser]Luwian[/eluser]
Thanks bradym.

I am sure my database connection info is right and display_errors was set to ON.

My code is simply:

Code:
<?php

class Testdb extends Controller{
    
    function Testdb()
    {
        parent::Controller();
    }
    
    function index()
    {
        $data['title'] = 'Test Database for ColetEstate';
        $data['query'] = $this->db->get('landlord');
        
        $this->load->view('testdb_view', $data);
    }
    
}

?>

/config/autoload.php:
Code:
$autoload['libraries'] = array('database');

/config/database.php
Code:
$active_group = "default";

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "";
$db['default']['database'] = "coletestate";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['active_r'] = TRUE;
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";

BTW,
I imitate the video tutorial to build the simply blog but
there are also noting to display when I set $route['scaffolding_trigger'] = "scaffolding" in /config/routes.php


............................


[Help] Why is nothing to display when I set "$autoload['libraries'] = array('database');" in autoload.php ? - El Forum - 07-29-2007

[eluser]bradym[/eluser]
[quote author="Luwian" date="1185721823"]
My code is simply:
[/quote]
What you've posted looks fine, what's in your view?

[quote author="Luwian" date="1185721823"]
I imitate the video tutorial to build the simply blog but
there are also noting to display when I set $route['scaffolding_trigger'] = "scaffolding" in /config/routes.php
[/quote]
You need to enable scaffolding, take a look at http://ellislab.com/codeigniter/user-guide/general/scaffolding.html.

Brady


[Help] Why is nothing to display when I set "$autoload['libraries'] = array('database');" in autoload.php ? - El Forum - 07-29-2007

[eluser]Luwian[/eluser]
view code

Code:
<html>
<head>
<title><?=$title?></title>
</head>

<boyd>
<h1>Testing database</h1>

&lt;?php foreach($query->result() as $row): ?&gt;

<h3>&lt;?=$row->surname?&gt;</h3>
<p>&lt;?=$row->firstname?&gt;</p>

<hr>

&lt;?php endforeach; ?&gt;

&lt;/body&gt;
&lt;/html&gt;

thanks again


[Help] Why is nothing to display when I set "$autoload['libraries'] = array('database');" in autoload.php ? - El Forum - 07-29-2007

[eluser]bradym[/eluser]
Hmm.. The only thing that jumps out at me is the <boyd> instead of &lt;body&gt;, but I'm not convinced that's the real problem. I'm guessing there's an issue with the database, but that's a complete guess cause I can't see anything else wrong.

Hopefully someone else will be able to give some helpful hints.

Sorry I can't be more helpful.

Brady


[Help] Why is nothing to display when I set "$autoload['libraries'] = array('database');" in autoload.php ? - El Forum - 07-29-2007

[eluser]Luwian[/eluser]
Thanks Brady.

I will try again. maybe I need reinstall Mac. Smile

Thank you again.

LU WEI


[Help] Why is nothing to display when I set "$autoload['libraries'] = array('database');" in autoload.php ? - El Forum - 07-30-2007

[eluser]Derek Allard[/eluser]
Blank pages are almost always due to PHP errors, only the server is suppressing the error. Try the instructions on this page and if nothing still happens, you may need to contact your host.


[Help] Why is nothing to display when I set "$autoload['libraries'] = array('database');" in autoload.php ? - El Forum - 07-30-2007

[eluser]esra[/eluser]
Check you database.php config file for blank spaces before &lt;? or after ?&gt;.


[Help] Why is nothing to display when I set "$autoload['libraries'] = array('database');" in autoload.php ? - El Forum - 07-30-2007

[eluser]walterbyrd[/eluser]
For me, the problem was caused from not having the php4-mysql module installed and configured. Are you working on your own host, or shared hosting?