Re: newbie MySQL question

From: Date: Sun, 20 May 2001 07:05:30 +0000
Subject: Re: newbie MySQL question
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-9469@lists.php.net to get a copy of this message
> $result = mysql_query("select * from shows"); Change to > $result = mysql_query("select * from shows ORDER BY date DESC"); On Saturday 19 May 2001 21:45, Matt Nigh wrote: > hi, i'm building a website right now with a shows page on it which will > scroll horizontally in a window. i have each show listed in a table called > shows (db is called almavale_board) with the following fields: > > id - bandplaying - venue - date - time - cover - description > > > what i need to do is have the shows listed by date, having the latest date > listed first. here's the code i have presently: > > > <table bgcolor=white cellpadding=0 cellspacing=0 border=0><tr> > <?php > $link = mysql_connect("localhost","almavale","violet"); > if(!$link) die ("Could not connect to MySQL!"); > mysql_select_db("almavale_board",$link); > $result = mysql_query("select * from shows"); > $num = mysql_numrows($result); > for($x=0;$x<$num;$x++) { > $row = mysql_fetch_object($result); > print "<td valign=top><table width=200 bgcolor=white cellpadding=4 > cellspacing=4 border=0><tr><td bgcolor=white valign=top><font face=verdana > size=1> > > <b>$row->bandplaying</b><br>$row->venue<br>$row->date<br>$row->time<br>$row >- > > > >>cover<br>$row->description<br><br></font></td></tr></table> > > </td> > "; > } > mysql_close($link); > ?> > </tr></table> > > > > oh and the date is in this format : Month-Day-,Year (ex. May 19, 2001) > > if anyone can help me out on this at all (or has any questions about my > problem), please reply to this post, i'd be very appreciative. > > > > > Thanks, > > Matt -- Paul Campbell http://www.cmm.uklinux.net/ mailto:paul.campbell10@ntlworld.com paul@cmm.uklinux.net

« previous php.db (#9469) next »