ramjai Posted February 27, 2009 Share Posted February 27, 2009 hi everybody, I want to fetch the maximum value of a field called type from the table named type but i am not getting the result any one can help me. Coding $type1=pg_query("select max(type) from type where layerid=$lay AND categoryid='$cat3'"); $type2=pg_num_rows($type1); $typ=pg_fetch_object($type1); echo $typ->type; Link to comment https://forums.phpfreaks.com/topic/147152-fetching-the-maximum-value-of-a-field-from-a-table/ Share on other sites More sharing options...
btherl Posted February 27, 2009 Share Posted February 27, 2009 The result will be called "max", not "type", unless you give it an alias. Link to comment https://forums.phpfreaks.com/topic/147152-fetching-the-maximum-value-of-a-field-from-a-table/#findComment-772485 Share on other sites More sharing options...
Mchl Posted February 27, 2009 Share Posted February 27, 2009 Try echoing pg_last_error after running the query Link to comment https://forums.phpfreaks.com/topic/147152-fetching-the-maximum-value-of-a-field-from-a-table/#findComment-772487 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.