RE: assign associative array values to variables? SOLVED

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

 



On 18 March 2009 13:21, PJ advised:

> Thank you, once again, dg. Could not get it to work... whatever...
> But I did find an unexpected solution which made things very simple.
> This is the part for the categories section:
> 
> if ( isset( $book_categories[$bookID] ) ) {
>     foreach ( $book_categories[$bookID] AS $categoryID ) {
>         if ( isset( $category[$categoryID] ) ) {
>         *$catvar = array_values($category[$categoryID]);         $cat
=
>         $catvar[1];* $catn = preg_replace("/[^a-zA-Z0-9]/", "", $cat);
>         echo "<a href='categories/", $catn, ".php'>", $cat,
>             "</a>&nbsp;&nbsp;  "; }
>         }
>     }

I realise I'm a bit behind the curve on this, but this looks like a
rather convoluted way of doing what you want to do. However, it's rather
difficult to tell without *specifics* -- can you post the output from
var_dump($book_categories) and var_dump($category), and a snippet of
what you want the eventual output from that to look like, so we can
actually work out the most efficient route from one to the other?  (It
might also be helpful to know where $book_categories and $category come
from originally -- are they the results of a database query?)

Cheers!

Mike

 --
Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

-- 
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