I have created a class to define a user and various attributes, into this class I have added an array which is supposed to contain contact fetched from a contact tabe.
The problem:
When I user mysql fetch array in the default manner it only retrieves and stores in the object array numeric indices, not the field names as keys. If I supply the MYSQL_ASSOC constant to the fetch array function I get no data stored in the object array variable.
My assignment goes something like this:
for($i = 0; $i < mysql_num_rows($result); $i++)
{
$row = mysql_fetch_array($result);
$this->array[$i] = $row;
}
If I understand php arrays the above code should make $this->array[$i] a multideminsional array, and further since the default for fetch array is to create both numeric and associative keys then the object
array $this->array[1] (for example) should contain another array with the field names as keys.
I have also tried mysql fetch object which then results in no data being stored in the object array.
Any thoughts would be appreciated.
John Pierce