query = SELECT * FROM design_trip,meal_pref,types where design_trip.meal_id = meal_pref.meal_id and design_trip.triptype_id = types.type_id;
There is two columns called "name_en", when i write in foreach
<?php echo $value->budget; ?>
its getting just first table value.
I'm using this in PDO query to get values from 3 table join, how can i print this values separately?
You could give separate names when selecting for the fields. Like
SELECT design_trip.meal_id as designtripmealId
FROM design_trip,meal_pref,types
where design_trip.meal_id = meal_pref.meal_id
and design_trip.triptype_id = types.type_id;
To get all the fields incase you don't want to specify the rest of the fields, you can use table_name.*
.
try this
SELECT * FROM table1
JOIN table2
ON table1
. userid
= table2
. userid
WHERE table1
. userid
= 1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.