Re: Getting two queries into one result set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Graham Cossey wrote:

You don't say how many tables you have, how they are named or anything
outside of the query itself.

Assuming that not all your tables are named PID_* how about simply doing

SHOW TABLES LIKE '%PID_%'

and selecting appropriate results within the php script using strstr
or regular expressions? SHOW TABLES is (normally) such a quick query
returning a larger result set shouldn't be too much of a problem,
should it?



If it is, then you should rework your db to reduce the number of tables :)
Alternatively use multi-query with use_result and more_results.
If it's concise code that you are after, then set up all the search strings in an array, and pass this through a loop that performs each query at a time and cats the results into a new array.


HTH

Graham

On Wed, 02 Feb 2005 15:15:38 +0100, Marek Kilimajer <lists@xxxxxxxxxxxxx> wrote:


Shaun wrote:


Hi guys,

Thanks for your replies but neither UNION or REGEXP can be used with SHOW
TABLES...

Any ideas?


It's time to change your table design. Use one pid table and add another
column that would hold the number.

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









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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux