Welcome Guest, Not a member yet? Register   Sign In
Error in the query database ?
#1

Hi guys.
I'm running into me with the following error to list database data:
Link: http://build.elevsaude.com/
Would anyone help me? For I see no error in the code below:

Controller file:
public function index() {
// Model load
$this->load->model('Runcode_model');
// Method run
$data['links'] = $this->Runcode_model->links_list();
// View load
$this->load->view('runcode', $data);
}

Model file:
class Runcode_model extends CI_Model {
public $elev_opera_id;
public $elev_opera_date;
public $elev_opera_hours;
public $ws_safe_id;
public $elev_opera_name;
public $elev_opera_logo;
public $elev_opera_link;

public function __construct() { 
parent::__construct();
}

// metodo que lista links das operadoras:
public function links_list() {
$query = $this->db->get('elev_operators'); Line 19
return $query->result();
}
}

View Archive:
<?php endforeach;
foreach ($links as $view) {
echo '<a class="orators-links-strucs"><img src="assets/fgs/'. $view->elev_opera_logo .'" class="orators-links-zoom-strucs"></a>';
};
?>

Reply
#2

Connect to database. http://www.codeigniter.com/user_guide/da...connecting
https://github.com/bcit-ci/CodeIgniter/b...ad.php#L54

Code:
$autoload['libraries'] = array(
    'database',
    // ... other libraries if needed.
);
Reply
#3

(06-02-2016, 02:07 PM)ivantcholakov Wrote: Connect to database. http://www.codeigniter.com/user_guide/da...connecting
https://github.com/bcit-ci/CodeIgniter/b...ad.php#L54

Code:
$autoload['libraries'] = array(
   'database',
   // ... other libraries if needed.
);

Thanks for the reply, actually forgot to assign.

I tried to run to see the result and I am faced with the following error (assuming that the database access settings are correct). Follow the link from the results: http://build.elevsaude.com

Reply
#4

If your username and password for MySQL are correct, then the circumstance that you are trying to access the MySQL server from the address 167.114.27.173 becomes important.

Usually MySQL is configured to accept connections from localhost for security reason. You have to check how the user wsprojcm_user is allowed to connect.

If the web-server and MySQL are installed on a same machine, then change 167.114.27.173 to localhost and see what would happen. Otherwise you have to negotiate with the MySQL server owner/administrator how the connection to be made.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB