Saturday, 15 August 2015

php - JOIN multiple tables in single query using LEFT OUTER JOIN -



php - JOIN multiple tables in single query using LEFT OUTER JOIN -

i'm having difficulties using left outer bring together in multiple tables.

my tables are: countries, customer_info, package_types, service_types , shipping_info

this code far:

$sql = "select shipping_info.shipping_id, shipping_info.weight, shipping_info.width, shipping_info.height, shipping_info.length, shipping_info.cost, shipping_info.status, service_types.service, package_types.package_type, countries1.country fromcountry, countries2.country tocountry, countries3.country resicountry, customer_info.name, customer_info.address , customer_info.city, customer_info.postcode, customer_info.zipcode, customer_info.phone, customer_info.email, customer_info.country shipping_info left outer bring together service_types on shipping_info.service_type = service_types.servicetype_id left outer bring together package_types on shipping_info.package_type = package_types.packagetype_id left outer bring together customer_info on shipping_info.customer_id = customer_info.customer_id left outer bring together countries countries1 on shipping_info.from_loc = countries1.country_id left outer bring together countries countries2 on shipping_info.to_loc= countries2.country_id left outer bring together countries countries3 on shipping_info.to_id = countries3.country_id"; $statement = $con_db->query($sql); $result = $statement->fetchall();

i'm getting fatal error in final line , believe that's because $result null. i'm unable figure out error.

appreciate help.

it may query has next manual error:

tablename or fieldname mismatch

php sql pdo left-join

No comments:

Post a Comment