okay. i'm half way there.
some more background first:
i have a 'reviews' table of albums, movies, video games, shows, random things, and publications.... i want to select the 50 newest submitted reviews that have been 'approved' by the admin hence WHERE approved = 1..
i also want two options in this. one. to sort by date.. (or in this case, id number... since the bigger id's are the newest...).. and by name... i can get it to sort by id DESC no problem. but, when i try to sort by the 'title' columns, it does it sequentially, instead of ordering them all together.... like it alphabetically sorts bands, then movies, then shows... etc. instead of sorting them alphabetically as a compiled list.
is there a way to consider six columns as one list ? to be ordered alphabetically ?
here's the code thus far.....
if (!isset($sort)) {
$sort = 0;
}
if($sort == 0) {
$sort_recent = "id DESC";
} else {
$sort_recent = "movie, publication, headline_tour, game, random_name, band";
}
$sqlmax = "SELECT id FROM $table1
WHERE approved = 1 ORDER BY $sort_recent LIMIT 50";
$resmax = mysql_query($sqlmax,$connection)
or die("couldn't select recent rev_id's");
while($rowmax = mysql_fetch_array($resmax)) {
$recent_id = $rowmax['id'];
$sqlnew = "SELECT id, DATE_FORMAT(date_approved, '%c.%e') AS date_add, type,
band, movie, publication, headline_tour, game, random_name
FROM $table1 WHERE id = \"$recent_id\"";
$resnew = mysql_query($sqlnew,$connection)
or die("couldn't get newest reviews");
while($rownew = mysql_fetch_array($resnew)) {
$id = $rownew['id'];
$type = $rownew['type'];
$date_add = $rownew['date_add'];
$band = $rownew['band'];
$band = stripslashes($band);
$movie = $rownew['movie'];
$movie = stripslashes($movie);
$headline_tour = $rownew['headline_tour'];
$headline_tour = stripslashes($headline_tour);
$publication = $rownew['publication'];
$publication = stripslashes($publication);
$game = $rownew['game'];
$game = stripslashes($game);
$random_name = $rownew['random_name'];
$random_name = stripslashes($random_name);
if($type == 1) {
$recent_list .= "
<TR>
<TD WIDTH=20 VALIGN=\"TOP\">
<IMG SRC=\"images/music/mus_icon.gif\" WIDTH=10 HEIGHT=10></TD>
<TD WIDTH=130 VALIGN=\"TOP\">
<FONT SIZE=2 FACE=\"Arial, Helvetica, sans-serif\">
$band</FONT></TD>
<TD WIDTH=30 VALIGN=\"TOP\">
<FONT SIZE=2 FACE=\"Arial, Helvetica, sans-serif\">
$date_add</FONT></TD>
</TR>";
} elseif($type == 2) {
$recent_list .= "
<TR>
<TD WIDTH=20 VALIGN=\"TOP\">
<IMG SRC=\"images/movies/mov_icon.gif\" WIDTH=10 HEIGHT=10></TD>
<TD WIDTH=130 VALIGN=\"TOP\">
<FONT SIZE=2 FACE=\"Arial, Helvetica, sans-serif\">
$movie</FONT></TD>
<TD WIDTH=30 VALIGN=\"TOP\">
<FONT SIZE=2 FACE=\"Arial, Helvetica, sans-serif\">
$date_add</FONT></TD>
</TR>";
} elseif($type == 3) {
$recent_list .= "
<TR>
<TD WIDTH=20 VALIGN=\"TOP\">
<IMG SRC=\"images/pubs/pub_icon.gif\" WIDTH=10 HEIGHT=10></TD>
<TD WIDTH=130 VALIGN=\"TOP\">
<FONT SIZE=2 FACE=\"Arial, Helvetica, sans-serif\">$publication</FONT></TD>
<TD WIDTH=30 VALIGN=\"TOP\">
<FONT SIZE=2 FACE=\"Arial, Helvetica, sans-serif\">$date_add</FONT></TD>
</TR>";
} elseif($type == 4) {
$recent_list .= "
<TR>
<TD WIDTH=20 VALIGN=\"TOP\">
<IMG SRC=\"images/shows/show_icon.gif\" WIDTH=10 HEIGHT=10></TD>
<TD WIDTH=130 VALIGN=\"TOP\">
<FONT SIZE=2 FACE=\"Arial, Helvetica, sans-serif\">
$headline_tour</FONT></TD>
<TD WIDTH=30 VALIGN=\"TOP\">
<FONT SIZE=2 FACE=\"Arial, Helvetica, sans-serif\">
$date_add</FONT></TD>
</TR>";
} elseif($type == 5) {
$recent_list .= "
<TR>
<TD WIDTH=20 VALIGN=\"TOP\">
<IMG SRC=\"images/games/game_icon.gif\" WIDTH=10 HEIGHT=10></TD>
<TD WIDTH=130 VALIGN=\"TOP\">
<FONT SIZE=2 FACE=\"Arial, Helvetica, sans-serif\">
$game</FONT></TD>
<TD WIDTH=30 VALIGN=\"TOP\">
<FONT SIZE=2 FACE=\"Arial, Helvetica, sans-serif\">
$date_add</FONT></TD>
</TR>";
} else {
$recent_list .= "
<TR>
<TD WIDTH=20 VALIGN=\"TOP\">
<IMG SRC=\"images/random/rand_icon.gif\" WIDTH=10 HEIGHT=10></TD>
<TD WIDTH=130 VALIGN=\"TOP\">
<FONT SIZE=2 FACE=\"Arial, Helvetica, sans-serif\">
$random_name</FONT></TD>
<TD WIDTH=30 VALIGN=\"TOP\">
<FONT SIZE=2 FACE=\"Arial, Helvetica, sans-serif\">
$date_add</FONT></TD>
</TR>";
}
}
}