If not, I need some help on my very first use of php!
ok, here's how it goes.
I've got this little piece of code that extracts the date, city, & state from a table in mySQL. It shows all the records within the given limit. However, I want them to be sorted by the showDate column so that if I add another showing, it will appear in it's place chronologically, instead of at the end of the list.
mysql_connect("localhost","$DB_user","$DB_password") or die("Not yet connected to mySQL database.");
@mysql_select_db("$DB_name") or die("Unable to select database $DB_name");
$DateQuery = "SELECT date_format(showDate, '%a, %b %D') FROM $DB_table LIMIT $ShowListStart,$ShowListLength" or die('line 11');
$DateResult = mysql_query($DateQuery) or die('second query failed!') or die('line 12');
$sqlquery = "SELECT showState,showCity FROM $DB_table LIMIT $ShowListStart,$ShowListLength" or die('line 13');
$result = mysql_query($sqlquery);
$number = mysql_num_rows($result);
$i = 0;
if ($number < 1) {
print "<CENTER>No Show info right now.</CENTER>";
} else {
while ($number > $i) {
$ShowState = mysql_result($result,$i,"showState");
$ShowCity = mysql_result($result,$i,"showCity");
$ShowDate = mysql_result($DateResult,$i) or die('showdate is not valid!');
print ("$ShowDate @ $ShowCity, $ShowState - <a href=\"main.php?scene=0&show=$i\">More Info</a><br>") or die('line 26');
$i++;
}
}
thanks a lot.