I have a table like this:
Table: categories
id | name
1 | Foo
2 | Bar
PHP
In php I want to print out like $category[1] (the name of the choosen id)
So if I write:
echo $category[1];
The result will be "Foo"
Sadly I've only come this far...
$result = mysql_query("SELECT * FROM categories");
while($row = mysql_fetch_array($result))
$row,whilecycle goes through all rows, where is the problem? just store the data from$rowinto some array$row's index[1]would refer to the column value (depending on the column order passed in SELECT) of each row and not to the actual value itself.