Re: very urgent

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

 



Assuming tables look like:

tbl_media = id, media_name, address, media_type
tbl_travels = tid, travel_name, address
tbl_tour = trid, tour_name, address

select t1.media_name   as media_name,        Aliases for field names
       t1.media_type   as media_type,        note how 'address' is
       t2.travel_name  as travel_name,       aliased for the t2 and t3
       t2.address      as travel_address     so that when the fields
       t3.tour_name    as tour_name,         are returned in an array
       t3.address      as tour_address       you know which is which

  from tbl_media   as t1,                    Aliases for tables
       tbl_travels as t2,                    the tx nomenclature is
       tbl_tour    as t3                     used in conjuction with
                                             selects and where clauses

 where t2.travel_name = $_REQUEST['name']    A VERY simple selection
   and t1.id = t2.id                         clause, but you see how
   and t3.id = t2.id;                        the id
   
This SHOULD return an array that looks something like:

$row = array (array [0..n] = 
               media_name => sqlresults.media_name,
               media_type = sqlresults.media_type,
               travel_name = sqlresults.travel_name,
               travel_address = sqlresults.travel_address,
               tour_name = sqlresults.tour_name,
               tour_address = sqlresults.tour_address
              ) 

--- In php-objects@xxxxxxxxxxxxxxx, gopi nath <gopivsb@...> wrote:
>
> my table type:
> 
> 
>   tbl_media =    id,name,address.
>  tbl_travels = tid,name,address.
> tbl_tour = trid,name,address.
> ...
> ....
> for example
> 
> $search = $_POST['txtSearch'];
>     if($search != ""){
>     $t1 = "(SELECT * from tbl_travels where VNAME='".$_REQUEST['txtSearch']."' or VCATAGORY='".$_REQUEST['txtSearch']."')UNION(SELECT * from tbl_stay where VNAME = '".$_REQUEST['txtSearch']."' OR VCOMPANYNAME = '$search')UNION(SELECT * FROM tbl_eatouts where VNAME = '$search' or VCOMPANYNAME = '$search')UNION(SELECT * FROM tbl_finance where VNAME = '$search' or VCOMPANYNAME = '$search')";
> }
>   
> 
> 
> 
>       Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/
> 
> [Non-text portions of this message have been removed]
>



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux