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'")); Quote 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. Quote 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 Quote 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 Quote 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. Quote 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 Quote 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 Quote 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 Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.