markjohnson Posted October 30, 2011 Share Posted October 30, 2011 Hi, I have a SQL statement: $sql='SELECT PROPID, ADDRESS_1, ADDRESS_2, TOWN, POSTCODE1, POSTCODE2, BEDROOMS, BATHROOMS, RECEPTIONS, PRICE, TRANS_TYPE_ID FROM properties WHERE TRANS_TYPE_ID=2 AND BEDROOMS =3 AND PROP_SUB_ID IN (1,2,3,4,5,6,21,22,23,24,27,30,95,128,131) ORDER BY DATE_ADDED, PROPID DESC'; I want to be able to get the fields and their corresponding values as such: $result['TRANS_TYPE_ID']=2; $result['BEDROOMS']=3; And then capture the values in PROB_SUB_IN IN(*) How can I do this? Any help will be greatly appreciated. Thanks Link to comment https://forums.phpfreaks.com/topic/250130-select-keyvalue-from-a-sql-where-clause/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.