Re: Multiple Select
| From: | Cynic | Date: | Sat, 23 Dec 2000 07:43:09 +0000 |
| Subject: | Re: Multiple Select | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31662@lists.php.net to get a copy of this message | ||
Ok, I'll elaborate somewhat...
$conn = mysql_connect( 'hostyouconnectto' , 'username' , 'password' )
;
$tables = mysql_list_tables( 'yourdatabase' , $conn ) ;
$i = 0 ;
while( $table = mysql_tablename( $tables , $i ) ) {
$rs = msyql_query( 'select * from ' . $table . ' where name = "' .
$keyword . '"' ) ;
# ... do your stuff ...
mysql_free_result( $rs ) ;
$i++ ;
}
At 08:19 23.12. 2000, Dhaval Desai wrote the following:
--------------------------------------------------------------
>Hi!
>
>
>I want a little help from you guys. I want a multiple
>select statement whoch can search for the same keyword
>in various tables in the same database..
>THis will be for a complete site search.
>
>
>Seomthing like.
>"select * from table where name='$keyword'";
>
>Something like that but should search all the
>tables...in the databse.
>
>
>
>Is it possible to do that way..? I think the key
>option...or something in Mysql..will do that..Please
>tell me how to do that..
>
>
>Thank You
>Dhaval Desai
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Shopping - Thousands of Stores. Millions of Products.
>http://shopping.yahoo.com/
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
------end of quote------
____________________________________________________________
Cynic:
A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.
cynic@mail.cz