php - 如何在一个表中获取多语言数据(codeigniter,Mysql,Php)

标签 php mysql codeigniter

你好吗?

我的网站有多种语言(英语、法语、阿拉伯语等),我在后台表格中显示内容(帖子)..

我想在此表中显示(标题、内容、支持语言)

查看数据库结构

http://saudi-hotels.info/tables.jpg

enter image description here

我想像这张表一样显示数据

http://saudi-hotels.info/table_information.jpg

enter image description here

我试图获得一个好的查询,但我无法查看我的查询:

$this->db->from('localization_posts PL');
        $this->db->join('posts PO' , 'PO.id_post = PL.id_post');
        $this->db->join('langauges LN', 'LN.id_language = PL.id_langauge');
        $result = $this->db->get()->result_array();

最佳答案

如果我没记错的话,你想要给定的查询类型。

试试这个。

SELECT lp.title_post, lp.content_post, p.views_post, 
       GROUP_CONCAT(l.id_language) AS l.support_language 
FROM localization_posts lp
INNER JOIN posts p ON lp.id_post = p.id_post
LEFT JOIN languages l ON lp.id_language = l.id_language;

希望能有所帮助。

关于php - 如何在一个表中获取多语言数据(codeigniter,Mysql,Php),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15043693/

相关文章:

php 用户使用或不使用 AJAX 注销

php - 分拣车辆登记

mysql - Node.js 安全

php - 如何过滤 JOIN 中的记录以处理重复记录?

codeigniter - codeigniter 扩展 show_error

PHP从表中选择数据,不起作用

php: file_get_contents 编码问题

php - MongoDB - PHP - MongoCursorException 'Cursor not found'

php - 生成贷款收据报告(退款或反向交易)

codeigniter - 如何让 form_validation 在 Codeigniter 中正常工作