rndilger Posted December 26, 2008 Share Posted December 26, 2008 Hello, I can't seem to figure out how to check a particular subset of array values obtained by using the following statement: while(list($id, $member, $mem_producer, $mem_supplier, $firstname, $lastname) = mysql_fetch_array($resultType)) I would like to use a loop to check and see whether $mem_producer, $mem_supplier, and more categories to come are set to 'y' or 'n'. Does the while(list...) statement write the mysql values to an array? If so, what is the name of that array and can I grab a subset of it? Your help is much appreciated. Thanks, Ryan Link to comment https://forums.phpfreaks.com/topic/138428-looping-through-array-subset/ Share on other sites More sharing options...
Wolphie Posted December 26, 2008 Share Posted December 26, 2008 list() doesn't write the values to an array. The result is already returned as an array i.e. mysql_fetch_array(); Link to comment https://forums.phpfreaks.com/topic/138428-looping-through-array-subset/#findComment-723788 Share on other sites More sharing options...
rndilger Posted December 26, 2008 Author Share Posted December 26, 2008 list() doesn't write the values to an array. The result is already returned as an array i.e. mysql_fetch_array(); Thanks for the response. If the result is already returned as an array, how can I use that array to create another array? I want to use something like: $mem_type_check = array_slice(whateverthearrayiscalled,2,count(mem_type)+2); Ryan Link to comment https://forums.phpfreaks.com/topic/138428-looping-through-array-subset/#findComment-723799 Share on other sites More sharing options...
9three Posted December 26, 2008 Share Posted December 26, 2008 Hello, I can't seem to figure out how to check a particular subset of array values obtained by using the following statement: while(list($id, $member, $mem_producer, $mem_supplier, $firstname, $lastname) = mysql_fetch_array($resultType)) I would like to use a loop to check and see whether $mem_producer, $mem_supplier, and more categories to come are set to 'y' or 'n'. Does the while(list...) statement write the mysql values to an array? If so, what is the name of that array and can I grab a subset of it? Your help is much appreciated. Thanks, Ryan This: while($field = mysql_fetch_array($resultType) { $first = $field['firstname']; } the variable in the brackets [''] is replaced with whatever your database holds Link to comment https://forums.phpfreaks.com/topic/138428-looping-through-array-subset/#findComment-723806 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.