join sql help |
[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'); 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 thanks
[eluser]osci[/eluser]
since you 've never did a join before I suggest you read PHP Manual - Join. If you think it's too much read http://www.tizag.com/sqlTutorial/sqljoin.php which covers basic usage, but I still recommend you should read the first too.
[eluser]skeletonfriend[/eluser]
You need to have a foreign key in the Catalog table that references the Genre table in order to make a join. Code: $this->db->from('catalogo'); |
Welcome Guest, Not a member yet? Register Sign In |