Re: How to explode an array from a Database?

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

 



I tried to use the following (base) code:

----8<------------------------------------------------------------------
[01] $db_link   = db_connect();
[02]  $db_result = db_query($db_link, "SELECT serial,$category FROM categories");
[03]  $cat_array = db_fetch_all($db_result);
[04]
[05]  sort($cat_array, SORT_NUMERIC);
[06]
[07]  foreach($cat_array as $row) {
[08]    extract($row);
[09]    $strg .= "        <a href=\"/?what=category&num=$serial\">$category</a><BR>\n";
[10]  }
[11]
[12]  db_close($db_link);
----8<------------------------------------------------------------------

the problem is in db_query (line 02) with "$category"  where  the  value
can change between e.g.

category
cat_de
cat_fr
cat_ee
cat_ru
...

so, how I can evaluate the name of the value of the  variable  $category
in line 09?

Thanks

-- 
Michelle Konzack        Miila ITSystems @ TDnet
GNU/Linux Developer     00372-54541400

Attachment: signature.asc
Description: Digital signature


[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