You are here: Re: Need help on how to retrieve the respective value of array from another table « PHP Programming Language « IT news, forums, messages
Re: Need help on how to retrieve the respective value of array from another table

Posted by Lime on 08/14/07 04:36

On Aug 13, 3:32 pm, petersprc <peters...@gmail.com> wrote:
> You could select:
>
> if (count($splitContent)) {
> $set = join(',', $splitContent);
> $cats = $mdb2->queryAll("select * from
> categories_table where catid in ($set)");
>
> }
> > foreach ($splitContent as $result) {
> > echo $result;
> > }
>
> On Aug 13, 2:19 am, Andz <acl20032...@gmail.com> wrote:
>
> > I'm using explode() to extract and make an array() readable. I'm able
> > to make the array() from dbase readable.
>
> > categories_table {
> > catid name
>
> > 1 'test1'
> > 2 'test2'
> > 3 'test3'
>
> > }
>
> > implode_table {
> > email catid
>
> > test@local 1,2,3
> > help@local 2,3
>
> > }
>
> > For example, if test@local logged in to the system, how can test@local
> > load all the information of the catid he selected?
>
> > My code for the moment fetch only all the catid that's being saved
> > under test@local account.
>
> > foreach (getImplodeCategoriesByEmail($email) as $explodeCat) {
> > $delimiter = ",";
> > $content = $explodeCat['catid'];
> > $splitContent = explode($delimiter, $content);
>
> > foreach ($splitContent as $result) {
> > echo $result;
> > }
>
> > }
>
> > Assume that getImplodeCategoriesByEmail($email) is fetching all the
> > records that match the email. This piece of code worked.
> > It gives me a result of 123.
>
> > THE PROBLEM: HOW CAN I LOAD ALL THE INFORMATION OF THE EXTRACTED
> > CATID???
>
> > The output should be like this
>
> > 1 test1
> > 2 test2
> > 3 test3
>
> > What query AND how to implement it? If possible, please include
> > code.... THANKS and MORE POWER!!!




try this

select * from categories_table where catid in (select * from
implode_table where email = user_email)";


this will give you cat_id and name of cat_id in the user mail selected
cats_id .., this would work fine , in case just chk the cats_id come
correct in IN () might (',')

try it ...take care

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация