[eluser]mattylux[/eluser]
hello
This is my controller and I would like connects the two tables with join sql
but I have never done I'd need some advice.
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Catalogo extends CI_Controller{
function __construct(){
parent:: __construct();
}
function index(){
$data['title'] = "Catalogo | Strade di carta";
$this->load->view('include/v_header',$data);
$this->load->view('include/v_menu');
$this->load->view('v_catalogo');
$this->load->view('include/v_footer');
}
function elenco(){
$tipo = $this->uri->segment(2);
$genere = $this->uri->segment(3);
$catalogo = $this->uri->segment(4);
$data['titolo'] = "Catalogo > ".ucwords(str_replace("-"," ",$tipo))." > ".ucwords(str_replace("-"," ",$genere))." > ".ucwords(str_replace("-"," ",$catalogo))." | Strade di carta";
$data['catalogo'] = $catalogo;
$data['tipo'] = $tipo;
$data['genere'] = $genere;
$this->load->view('include/v_header',$data);
$this->load->view('include/v_menu');
$this->load->view('catalogo/v_elenco',$data);
$this->load->view('include/v_footer');
}
}
?>
the two tables are called for the database catalogo and generi in my library
Table is in the catalog are: id, codice_bilbioteca, autore_nome, autore_cognome, title, series publication.
genres in the table: id and kind. how can I do to relate them
libri_model
Code:
<?php
class Libri_model extends CI_model {
function __construct()
{
parent:: __construct();
}
$this->db->select('catalogo.codice_biblioteca, catalogo.autore_nome, catalogo.autore_cognome, catalogo.titolo,catalogo_collana, catalogo.pubblicazione');
thanks