← Комьюнити

Codeigniter страница news зачем не работает ????????

ylham chakanov1 ответов

{php;}

 

 

уффффффффффффффффффффффффффффффф что там не работает просто умераюю

 

<?php

defined("BASEPATH") OR exit('No direct script access allowed');

class News extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('news_model');
}

public function index(){
$data['title'] = 'All news43';
$data['news'] = $this->news_model->getNews();

$this->load->view("templates/header", $data);
$this->load->view("news/index", $data);
$this->load->view("templates/footer");

}
}

 

<h1>first page</h1>

<?php foreach ($news as $key => $value): ?>
<h2><?php echo $value['title'];?></h2>
<?php endforeach ?>

 

 

<?php

class News_model extends CI_Model {
public function __construct() {
$this->load->database();
}

public function getNews($slug =FALSE) {
if($slug === FALSE) {
$query = $this->db->get('news');
return $query->result_array();
}

$query=$this->db->get_where('news',array('slug'=>$slug));
return $query->row_array();
}
}

 

показывает это ------

 

 

A PHP Error was encountered
Severity: Warning

Message: mysqli::real_connect(): (HY000/1045): Access denied for user ''@'localhost' (using password: NO)

Filename: mysqli/mysqli_driver.php

Line Number: 203

Backtrace:

File: C:\xampp\htdocs\kinomonster\application\models\News_model.php
Line: 5
Function: database

File: C:\xampp\htdocs\kinomonster\application\controllers\News.php
Line: 8
Function: model

File: C:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once

 

 

?

1 ответов

Пожалуйста, не дублируйте вопросы. Ранее вы уже задавали точно такой же вопрос:

/ru/qa/codeigniter-stranica-zacem-ne-rabotaet--3ophew/

Alex Kuznetsov