[英]How to get data from two table and order by second table Datamapper
My first table is product and second table is user我的第一个表是产品,第二个表是用户
In product table column is id, user_id,prname etc;产品表列是id、user_id、prname等;
In user table column is id, user_name, rating.在用户表中的列是 id、user_name、 rating。
I used this for get我用这个来获取
$user = new User();
$user ->get();
$products = new Product();
$products ->get();
Now I want to get products order by user rating现在我想通过用户评分获得产品订单
you should create another table for rating where product id and user id and rating value must have with primary key rating id.您应该创建另一个用于评级的表,其中产品 id 和用户 id 以及评级值必须具有主键评级 id。
then select the product according to rating value.然后根据评级值选择产品。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.