how about something like:

$count = 0;
$list = array();
$sql[]="select * from storyboards, ... ";
$sql[]="select * from storyboard2, ... ";
$sql[]="select * from storyboard3, ... ";
$sql[]="select * from storyboard4, ... ";
foreach ($sql as $thissql)
{       $result=MySQL_query($thissql,$db);
        while($row = MySQL_fetch_array($result))
                $list[$row["field_to_sort_by"] . "***" . ++$count] = $row;
        
}

ksort($list)

I haven't tried this precisely but the principle should work, and I have
tried this method of sorting arrays by an element of the member arrays.

        Tim Ward
        Senior Systems Engineer

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 24 April 2001 21:42
> To: [EMAIL PROTECTED]
> Subject: getting rows from separate tables stacked in a single array ?
> (newbie, mysql)
> 
> 
> Hi. 
> 
> This will probably sound simple to all of you but I am 
> hitting my head on
> a brick wall so far :-).
> 
> I need to generate a list (sorted by descending time) of 
> different objects
> referenced in multiple tables. All those objects share a key 
> related to a
> project.
> 
> 
> This works splendidly from a single table :
> 
> 
> 
> 
> $sql="select * from storyboards, where spot_id = \"$spot_id\" order by
> date_posted desc";
> $result=MySQL_query($sql,$db);
> while($row=MySQL_fetch_array($result))
> {
> $qt_title = $row["title"];
> $qt_duration = $row["duration"];
> $qt_date_posted = $row["date_posted"]; //(timestamp)
> $qt_description = $row["description"];
> $qt_id = $row["quicktime_id"];
>                                                               
>                              
> 
> }
> 
> Is there a mysql query that would allow me to stack complete rows in
> multiple tables at once (It seems more elegant because I can sort them
> while extracting them) or is there a way in PHP to 
> concatenate results in
> a single array and then sort them by time... ?
> 
> I tried to use a join query, wich produced an invalid query error. (I
> think it tries to produce a table with merged data, not just 
> a stack of
> rows).
>  
> 
> $sql4="select * from quicktimes, other_images, storyboards, where
> quicktimes.spot_id, other_images.spot_id, storyboards.spot_id =
> \"$spot_id\" order by date_posted desc";
> 
> thank you for your help !
> nicolas
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to