ChrisF79 Posted March 11, 2010 Share Posted March 11, 2010 I have the code below in a file and the $mls variable exists and is good. Unfortunately though, when I execute the code below, it doesn't return anything... just a blank page. I am expecting it to echo out the query but it doesn't. Any help would be greatly appreciated! function property_query($mls) { global $dbh; $query = "SELECT l.mls, l.list_price, l.listing_status, l.street_number, l.street_name, l.street_type, l.street_direction, l.unit_number, l.city, l.shortzip, l.subdivision_id, l.furnished, l.listing_long_description, l.elevator, l.year_built, l.beds_id, l.unit_floor, l.total_floors, l.full_baths, l.half_baths, l.sqft_living, l.sqft_total, l.garage_spaces, l.carport_spaces, l.private_pool, l.private_spa, l.acres, l.waterfront_description, l.boat_access, l.view, l.construction, l.roof, l.flooring, l.cooling, l.heating, l.irrigation, l.pets, l.hoa_fee, l.master_hoa_fee, l.condo_fee, l.broker_code, l.office_name, l.foreclosed, l.shortsale, l.broker_reciprocity, l.lat, l.lng, l.num_images, sub.id, sub.subdivision, sub.development, beds.beds_id, beds.beds_desc, status.listing_status_id, status.listing_status_desc FROM listings AS l, subdivisions AS sub, bedrooms AS beds, listing_status AS status WHERE l.mls = '".$mls."' AND l.subdivision_id = sub.id AND l.beds_id = beds.beds_id AND l.listing_status = status.listing_status_id "; return $query; } property_query($mls); echo $query; Link to comment https://forums.phpfreaks.com/topic/194841-need-help-with-my-first-function/ Share on other sites More sharing options...
roopurt18 Posted March 11, 2010 Share Posted March 11, 2010 $query is local to the function and thus not visible outside of it. Change: property_query($mls); echo $query; To: echo property_query( $mls ); And if you're going to use global variables you might as well not use functions. Link to comment https://forums.phpfreaks.com/topic/194841-need-help-with-my-first-function/#findComment-1024534 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.