1 edb Feb 25, 2008 03:24
3 edb Feb 25, 2008 03:55
Groovy! Looks really smart too. I'll give it a shot here very soon.
Thanks!
EDIT: by the way http://ahga.org/azxc08.php?disp=azxc_hg is the page this particular query is feeding (and is currently full of fake data for testing/developing purposes). It's kinda neat to make it look like posts in a blog yah? But getting paragraphs and smilies working is not that important given that I can come back to it in a few months and try again.
4 afwas Feb 25, 2008 04:02
$query = ("SELECT pilots.pilot_name, flights.site, flights.start_date, filghts.end_place, flights.MAX(miles), flights.story FROM `flights`, `pilots` WHERE flights.pilots_number = pilots.pilots_number AND wing_type = 'hg' AND flight_type = 'opendistance' GROUP BY `site` ORDER BY `site` ASC");
No need for the pilots_number in the output query
5 edb Feb 25, 2008 04:40
I ended up with "..... FROM this LEFT JOIN that ON this.foo = that.foo ....." which seems to do the trick. Oddly enough just listing the tables should have but didn't, and plain old JOIN didn't work either. I seem to recall "what should work didn't" last time I tried to do this type of thing, which happened to be for the same domain on the same server. Reckon it's something there, but not enough to worry over.
I'll play with crafting up some simplified home-made renderers to apply to the flight stories before committing to the database later. I think it's finally time to call that project "good enough" and get back to 240 skins. :)
6 edb Feb 25, 2008 05:06
oops. Somehow it is getting the MAX(miles) but mixing it with fields from different entries in the table. Even did it via phpmyadmin and got the same screwup. hmmm.... gonna just make it be multiple queries I guess.
7 edb Feb 25, 2008 06:13
hmmm.... Seems "GROUP BY" did weird things to the results. Specifically it mixed stuff up such that when I did a print_r on the results it would tell me that line item 17 had the distance results from line item 18 and the story text from line item 18. An abbreviated version of what seems to work is:
$query = ("SELECT flights.site, flights.various, flights.miles, pilots.name FROM `azxc08_flights` LEFT JOIN `azxc08_pilots` ON flights.pilots_number = pilots.pilots_number WHERE foo = 'bar' AND bing = 'bang' ORDER BY `site` ASC, `miles` DESC");
$sites = mysql_query($query);
$previous_site = '';
while( $a_site = mysql_fetch_assoc($sites) ) {
$site = $a_site['site'];
if( $previous_site == $site ) {
continue;
}
$previous_site = $site;
...
}
Not bad I guess.
I give you some Yabba type warranty only, because you see, I couldn' t test and actually I am blonde also.
--F