Forum Moderators: coopster
I ma getting my data from a sql table and basically I want and array that gives me the data.
I try doing
while (!$rs->EOF)//Continue until reaching last row
{
for($cls = 1; $cls < $numOfColumns; $cls++)
{
$data["'".columnName[$cls]."'"]["'".$column[0]."'"] = "'".column[$cls]."'";
}
$rs->moveToNextRow();
}
Now the above is sort of abstract but all it does it create an array called data that has the name of the column as the first key, the data from the first column (And current row) as second key and it is equal to the data (From that row) of the current column.
If I print_r the array atfer it is filled I get something like
Array ( ['English'] => Array ( ['admin'] => 'Admin' ['admin_title'] => 'Admin Panel' ) ['Swedish'] => Array ( ['admin'] => 'Admin' ['admin_title'] => 'Admin panel') )
But the problem is that if I try retrieving data, for example
echo = $data['English']['admin'];
I keep getting
Notice: Undefined index: English in ..... on line 30
I am rather new to php (But with experience in programming i general) and from what I have gathered I can't find what is wrong.
UPDATE: I managed to solve it. Seems the objects I was trying to set as keys weren't quite String so I fixed it by removing the quotes (') and called the proper function to get it into a string.
Couldnt find a DELETE thread button. Sorry
Best Regards
NooK
[edited by: NooK at 2:44 pm (utc) on Aug. 31, 2007]