Hi Chris,
Sorry... you're right!
With this I want to print the category in a html table after a search...
The search find the data, and print category and description. This category
is a number (ID), but I want to print the name of the category. My MYSQL
CATEGORY TABLE have ID and NAME, so using the SWITCH, I want to put in CASE
the ID and ECHO the NAME.
In other webs I do
switch($category) //where $category is an array fom the db
        case 1:
        echo "category1";

        case 2:
        echo "category2";

I want the 1, 2, 3... like the ID from my table, and "category1,
category2..." like the NAME from my table
Do not know if it was understood...
Thanks again

+                                                                          _
   // Emiliano Boragina _
   // DiseƱo & ComunicaciĆ³n //////////////////
+                                                                          _
   // emiliano.borag...@gmail.com  /
   // 15 40 58 60 02 ///////////////////////////
+                                                                          _

-----Mensaje original-----
De: Chris [mailto:dmag...@gmail.com] 
Enviado el: Viernes, 28 de Agosto de 2009 03:42 a.m.
Para: Emiliano Boragina
CC: 'Arie Nugraha'; php-db@lists.php.net
Asunto: Re: [PHP-DB] switch and while

Emiliano Boragina wrote:
> Thanks Arie...
> But I need to do "category1" be the ID of my table.
> Using this way I have CASE number_ID_table echo
> and will be automatic... Many CASES as ID I having in the database

If the $selectCategory is part of the database query, then you need to 
do it like that.

switch ($selectCategory)
   case 'category1':
     $query = .....;

   case 'category2':
     $query = .....;

You haven't really explained what you're trying to achieve so it's a bit 
hard to suggest anything.

Postgresql & php tutorials

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

Reply via email to