Re: irrational behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/5/12 PJ <af.gourmet@xxxxxxxxxxxx>:
> Could somebody please explain this?
> When the line - sort($category) is commented out, the output returns
> Notice: Undefined offset: in the line "36" for all the repeats (29 in
> this case)

Sure thing if you consider this:



> The code below:
> <?
> $SQL = "SELECT name
>        FROM categories ORDER BY category_id
>        ";
> $category = array();
> //[...]
>        $category[$row['name']] = $row;
> //[...] while
>    $cat = $category[$ii]['name']; //=======this is line 36==========
>

After setting only $arr[NAMEfromDB], why should be a numeric index $arr[INT] ?


Now just do var_dump($category) before and after your sort() - But I
don't see why you still have it, when the query itself does the
sorting.

Regards

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux