$result = sql_select( array( "docs.id_document AS id_doc", "docs.extension AS extension", "docs.fichier AS fichier", "docs.date AS date", "docs.titre AS titre", "docs.descriptif AS descriptif", "R.id_rubrique AS id_rub", "R.titre AS titre_rub"), array( "spip_documents AS docs", "spip_documents_liens AS lien", "spip_rubriques AS R"), array( "docs.id_document = lien.id_document", "R.id_rubrique = lien.id_objet", "lien.objet='rubrique'", "docs.mode = 'document'"), "", "docs.date DESC"); while ($row=sql_fetch($result)) { $titre=$row['titre']; // ... // and with the previous table: $titre_extension = $types[$row['extension']]['titre']; }