Hobbyist_PHPer Posted May 8, 2011 Share Posted May 8, 2011 Hi everyone, I used to know the function, but it was a very long time ago, for when you need to just extract a single value from a query... instead of having to use mysql_fetch_assoc in a while loop to build an array... e.g. $TheResultingFieldValue = mysql_fetch_SOMETHING(mysql_query("SELECT aField FROM aTable WHERE anotherField = 'aCondition'")); Link to comment https://forums.phpfreaks.com/topic/235876-php-function-to-extra-single-value-from-query/ Share on other sites More sharing options...
Hobbyist_PHPer Posted May 8, 2011 Author Share Posted May 8, 2011 The topic should say, extract, sorry. Link to comment https://forums.phpfreaks.com/topic/235876-php-function-to-extra-single-value-from-query/#findComment-1212521 Share on other sites More sharing options...
spiderwell Posted May 8, 2011 Share Posted May 8, 2011 its mysql_fetch_row, but that only has numbers instead of column names: see here Link to comment https://forums.phpfreaks.com/topic/235876-php-function-to-extra-single-value-from-query/#findComment-1212522 Share on other sites More sharing options...
fugix Posted May 8, 2011 Share Posted May 8, 2011 maybe this Link to comment https://forums.phpfreaks.com/topic/235876-php-function-to-extra-single-value-from-query/#findComment-1212525 Share on other sites More sharing options...
PFMaBiSmAd Posted May 8, 2011 Share Posted May 8, 2011 mysql_result can be used to fetch a single value. Link to comment https://forums.phpfreaks.com/topic/235876-php-function-to-extra-single-value-from-query/#findComment-1212526 Share on other sites More sharing options...
spiderwell Posted May 8, 2011 Share Posted May 8, 2011 maybe this i think that one returns everything about the field except its actual value, but i'm not sure Link to comment https://forums.phpfreaks.com/topic/235876-php-function-to-extra-single-value-from-query/#findComment-1212529 Share on other sites More sharing options...
fugix Posted May 8, 2011 Share Posted May 8, 2011 yeah, PFMaBiSmAd is right, mysql_result() is want you want Link to comment https://forums.phpfreaks.com/topic/235876-php-function-to-extra-single-value-from-query/#findComment-1212531 Share on other sites More sharing options...
spiderwell Posted May 8, 2011 Share Posted May 8, 2011 i concur Link to comment https://forums.phpfreaks.com/topic/235876-php-function-to-extra-single-value-from-query/#findComment-1212533 Share on other sites More sharing options...
Hobbyist_PHPer Posted May 9, 2011 Author Share Posted May 9, 2011 mysql_result can be used to fetch a single value. That's it, thank you, I couldn't remember ... You're a Genius Link to comment https://forums.phpfreaks.com/topic/235876-php-function-to-extra-single-value-from-query/#findComment-1212546 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.