Welcome Guest, Not a member yet? Register   Sign In
sombody help me with the tuturial?
#1

[eluser]ohale[/eluser]
Hi, I am a little bit into the tutorial and i have just got these errors. I dont know what i have done wrong. I just want someone to help me make seance of it. Just started out. I have created my database in phpMyAdmin and am running the project locally from mamp.

i got these errors,

Quote:A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/application/controllers/blog.php:2)
Filename: core/Common.php
Line Number: 414
A Database Error Occurred
Unable to select the specified database: blog
Filename: core/Loader.php
Line Number: 242

this is my code for blog_view
Code:
<html>
<head>
<title><?=$title?></title>
</head>
<body>
<h1>&lt;?=$headding?&gt;</h1>


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

<h3>&lt;?=$row->title?&gt;</h3>
<p>&lt;?=$row->body?&gt;</p>

<hr>

&lt;?php endforeach;?&gt;


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


and this is my code for blog
Code:
&lt;?php
class Blog extends CI_Controller {

    
    function index()
    {
        $data['title'] = "My blog title";
        $data['heading']= "My blog Heading";
        $data['query'] = $this->db->get('entries');
        
        
        $this->load->view('blog_view', $data);
    }
}
?&gt;

I would really appreciate a kick in the right direction.
#2

[eluser]ohale[/eluser]
probably something simple and stupid! but i cant see it
#3

[eluser]Eric Barnes[/eluser]
It sounds like it can't connect to your database:
Quote:A Database Error Occurred
Unable to select the specified database: blog
#4

[eluser]ohale[/eluser]
I have done this


Code:
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '';
$db['default']['password'] = '';
$db['default']['database'] = 'blog';

and also this

Code:
$autoload['libraries'] = array('database');
#5

[eluser]Eric Barnes[/eluser]
Are you sure those values are correct? The script is telling you what is wrong so it must be one or more of those are incorrect.
#6

[eluser]ohale[/eluser]
im really not sure!. im useing phpMyAdmin with Mamp i dont really know what elce i need to do to connect it.
#7

[eluser]Eric Barnes[/eluser]
Open your mamp start page and it will show the default username and password for mysql. http://localhost:8888/MAMP
#8

[eluser]ohale[/eluser]
gawd i feel so stupid! thanks a bunch mate. I really appreciate you taking the time to look at it 4 me.




Theme © iAndrew 2016 - Forum software by © MyBB