You are here: Re: Makeing multiple MySQL queries in a single query. « PHP Programming Language « IT news, forums, messages
Re: Makeing multiple MySQL queries in a single query.

Posted by cseymour on 10/04/06 22:44

Hi Daz,
Couldn't you create a PHP function that would fire all your queries
then return the results as an array, kind of like createing the "array
of arrays" you had mentioned?

Just a thought.

Good luck. I'll keep chewing on this one for a bit.

Chris
Daz wrote:
> cseymour wrote:
> > Hi Daz,
> > Are the data being return from the 2 queries similar? Have you looked
> > into using a UNION?
> >
> > For example:
> >
> > select ID_add 'Field1', ID_tpl 'Field2', null 'Field3', null 'Field4'
> > from address_add
> > Union
> > select null 'Field1', null 'Field2', ID_brd 'Field3', ID_per 'Field4'
> > from boardmembers_brd
> >
> >
> > Just a thought.
> >
> > Chris
> >
> >
> > Daz wrote:
> > > Hi. I am trying to select data from two separate MySQL tables, where I
> > > cannot use join, but when I put the two select queries into a single
> > > query, I get an error telling me to check my syntax. Both of the
> > > queries work fine when I use them to query the MySQL server directly.
> > >
> > > My guess is that the MySQL extension only expects a single resource
> > > back from the database, but get's several, or that it just checks the
> > > statement first, and decides it's not valid. However, my guesses and/or
> > > assumptions don't really make much of a difference as to the workings
> > > of the PHP MySQL extension.
> > >
> > > Would anyone know if there is something I can do to get around this
> > > problem?
> > >
> > > Any input would be appreciated.
> > >
> > > Thanks.
> > >
> > > Daz
>
> Hi Chris.
>
> Thanks for your input. Unfortunately, UNION will not work for what I
> need it for. I need to get the data from several different tables for
> different users. I was forced into breaking everything up into separate
> tables due to the MySQL restrictions and in the interest of keeping the
> data optimized and the database query response times fast. As a result,
> the number of colums is different for each of the 26 tables (ranging
> from 6 columns, to 530 columns). It could just be a flaw in my design,
> however, it would be fantastic to be able to put lots of SELECT queries
> together into a single query, and get all of the results back in the
> form of an array of arrays.
>
> Thanks again.

 

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

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