RE: [PHP-DB] switch and while

From: Date: Fri, 28 Aug 2009 09:43:17 +0000
Subject: RE: [PHP-DB] switch and while
References: 1 2 3 4  Groups: php.db 
Request: Send a blank email to php-db+get-46463@lists.php.net to get a copy of this message
A retail... I have two tables in my db. One for product description, in this one I have the column CATEGORY as INT. The other table is CATEGORY with ID and NAME of category. So, I do a select from this two tables... but I need switch the number of the CATEGORY in the first table to the NAME in the second table. Thanks a lot + _ // Emiliano Boragina _ // Diseño & Comunicación ////////////////// + _ // emiliano.boragina@gmail.com / // 15 40 58 60 02 /////////////////////////// + _ -----Mensaje original----- De: Chris [mailto:dmagick@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 string_CATEGORY_FIELD_table, > 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 = .....; break; case 'category2': $query = .....; break; } You haven't really explained what you're trying to achieve so it's a bit hard to suggest anything. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.db (#46463) next »