Page 1 of 1

Converting recordset into array

PostPosted: Wed Apr 04, 2012 10:03 am
by wisni1rr
I have a custom function to calculate the median of an array. I need help to convert all of a certain field in a found set to an array as used in the following code snippet.
It would be best to somehow use an if statement to convert to an array as in the case of:

Code: Select all
if ($record->val('FieldB') == "string"){
             Add $record->val('FieldB') to array


to use in place here:

Code: Select all
include ("ajstatistics.php");
$a = array(0, 1, 2, 3, 4, 5);

$the_median = median($a);


Thanks for all of your help!

Re: Converting recordset into array

PostPosted: Thu Apr 05, 2012 12:43 am
by jvinolas
I don't know if I understand what you want to do, but maybe this will help you (mysql fetch array):
http://www.tizag.com/mysqlTutorial/mysqlfetcharray.php