我的数据库中有下表
表名是“product_question”
product_question_id int(11) No
product_id int(11) No
user_name varchar(100) No
user_email varchar(200) No
envipor varchar(100) No
company_name varchar(100) No
product_name varchar(100) No
question text No
product_image varchar(500) No
date timestamp No CURRENT_TIMESTAMP
我有以下 sql 语句
我的 .php 页面中的语句 SQL 是
SELECT*
FROM product_question
WHERE company_name = $_SESSION['company_name']
但我希望将我的 .php 页面上的结果转换为以这种方式显示的简单语句
product: xbox 360
question: what is the price? - user_name: brian
product: ps3
question: has availability? - user_name: carlos
product: xbox 360
question: has games? - michael
product: ps3
question: what is the price? - user_name: luke
product: smartphone
question : brings android? - selena
product: xbox 360
question: how many games? - user_name: daniel
我希望句子的结果以这种方式显示
产品:Xbox 360
question: what is the price? - user_name: brian
question: has games? - michael
question: how many games? - user_name: daniel
产品:ps3
question: has availability? - user_name: carlos
question: what is the price? - user_name: luke
产品:智能手机
question : brings android? - selena
但是,我不知道创建 sql 语句以获得所需的结果。