Welcome Guest, Not a member yet? Register   Sign In
User System
#11

[eluser]plasmagames[/eluser]
http://plasmasteelgames.net/code


Go There and you will see it
#12

[eluser]majidmx[/eluser]
You have not loaded the database library.
Change your controller's constructor to this :
Code:
function News()
    {
        parent::Controller();
        $this->load->database();        
    }
#13

[eluser]plasmagames[/eluser]
it's still not working wtf?
#14

[eluser]majidmx[/eluser]
Try this :
Code:
$data['query'] = $this->db->query('SELECT * FROM entries')->result();


Also Check Derek's video and get the sample file as well.
Check if it works in your case or not.
Let us know if it worked or not.

Majid Fatemian
#15

[eluser]plasmagames[/eluser]
it didn't work but i will reinstall codeigniter and try again, then i will respond again
#16

[eluser]plasmagames[/eluser]
ok so i tried that after taking CI off my server and putting a fresh one on and i get this

Fatal error: Call to a member function query() on a non-object in /home/pmgames/public_html/code/system/application/controllers/psg.php on line 16

and the same thing with the original code
#17

[eluser]majidmx[/eluser]
Have you loaded the Database class, in your model's constructor ?

Code:
$this->load->database();
#18

[eluser]plasmagames[/eluser]
got it working i had to add this the the model contructor(with the right info of coarse)

$config['hostname'] = "localhost";
$config['username'] = "myusername";
$config['password'] = "mypassword";
$config['database'] = "mydatabase";
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
$config['cache_on'] = FALSE;
$config['cachedir'] = "";
$config['char_set'] = "utf8";
$config['dbcollat'] = "utf8_general_ci";

$this->load->database($config);
#19

[eluser]plasmagames[/eluser]
OMG More problems

Quote:Severity: Notice

Message: Undefined variable: query

Filename: views/index.php

Line Number: 14
A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: views/index.php

Line Number: 14

Line 14
Code:
<?php foreach($query as $row): ?>

corresponding line(controller)
Code:
$query = $this->db->get('news');
#20

[eluser]majidmx[/eluser]
try this :
Code:
$query = $this->db->query('SELECT * FROM news');




Theme © iAndrew 2016 - Forum software by © MyBB