Deadly Combo Of Header and Switch Together

Hi!!,Can any one solve my problem?? I am having a drop down menu and i am sending some variables through anchor tag like “<a href=index.php?a=1>” and so on.When i catch the variables in next page, i want to display the data from database which associates to the
“case $menu==1:header(‘Location:main.php?a=website’);”
and the website data must be shown.Dont know why its not working with the code

$query=(“SELECT * FROM menu”);
echo $row[$_GET[‘a’]];

is there any better alternative?? or i can change the code for an output??Donno if i have explained correctly what i want to say…:x

Here’s the problem.

$query=("SELECT * FROM menu");

A couple of problems exist here.

  1. The $menu variable is not used
  2. No query is sent to the database

See example #2 at the mysql_query documentation page for the way to do this.

First, figure out what query you’re going to make of the database.
The $menu variable contains “website” so how are you going to use it in the query. Are you going to restrict the results to where the field called item is equal to “website”?

FROM menu
WHERE item = "website"

Here is how you would create that query

$sql= sprintf(
    'SELECT * FROM menu WHERE item = "%s"',

Once you have your query you need to pass it to your database and get a result

$result = mysql_query($sql);

Finally after that, you can use your while and mysql_fetch_array to retrieve the rows

while ($row = mysql_fetch_array($result)) {

It can be preferable though to remove the assignment from inside the condition, and to use a one-and-a-half loop instead:

while (true) {
    $row = mysql_fetch_array($result);
    if (!$row) {