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 Quote Link to comment 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(); Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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.