Hey,
Im having a problem joining tables, and getting information im asking for from the database.
Its for a school listing section im creating.
I have these 3 tables:
schools (Contains listing information)
s_id
ect....
school_categories (Conains countries and counties/states/province)
cat_id
parent_id
cat_name
tidy_url (Using mod_rewrite. Saves cat name like new-york!)
school_cats (Each county/state/prince selected when adding a school is put in here)
school_id
region_id
i tried this to get schools in a certain "Region", but its only pulling up one record:
$query_getSchools = "
SELECT rw_schools.s_id, rw_schools.s_name, rw_schools.s_tel, rw_schools.s_email, rw_schools.s_site, rw_schools.s_listing_type, rw_orgs.o_name, rw_schools.s_areas, rw_school_logo.logo_img, rw_school_cats.region_id
FROM rw_school_categories
LEFT JOIN rw_school_cats ON rw_school_cats.school_id = rw_school_categories.cat_id
LEFT JOIN rw_schools ON rw_schools.s_id = rw_school_cats.school_id
LEFT JOIN rw_orgs ON rw_schools.org_id = rw_orgs.o_id
LEFT JOIN rw_school_logo ON rw_schools.s_id = rw_school_logo.s_id
WHERE rw_school_categories.tidy_url = '".$_GET['region']."' AND rw_schools.s_id = rw_school_cats.school_id
ORDER BY rw_schools.s_listing_type DESC ";
Im trying to get the schools by getting the cat_id from rw_school_categories using the tidy_url. Then getting the school id's from rw_school_cats, then obviously the school information. But its only getting one result.
Has anyone any ideas??
Thanks.
Danny