Thanks guys I got it to work. Also, thanksPaul for the PHP reference as well, I'm going to tool around with both as a learning experience.
Thanks! -------------------------------------------- -Alex "Big Al" Behrens E-mail: [EMAIL PROTECTED] Urgent E-mail: [EMAIL PROTECTED] (Please be brief!) Phone: 651-482-8779 Cell: 651-329-4187 Fax: 651-482-1391 ICQ: 3969599 Owner of the 3D-Unlimited Network: http://www.3d-unlimited.com Send News: [EMAIL PROTECTED] ----- Original Message ----- From: "Chris Adams" <[EMAIL PROTECTED]> To: "Paul DuBois" <[EMAIL PROTECTED]>; "Alex Behrens" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Saturday, March 30, 2002 6:38 AM Subject: Re: limiting a select > On 3/30/02 4:50 PM Paul DuBois wrote: > > > At 9:50 -0600 3/30/02, Alex Behrens wrote: > >> Hey guys, > >> > >> quick question, I'm setting up a script that does headlines for my site and > >> I need to pull some information from a table with my review info from it but > >> I only want to view the 7 latest reviews, how do I make it so I can only > >> view like 7 highest values for the "num" column? > >> > >> my query is this: > >> $r = mysql_query("SELECT * FROM hwureviews LIMIT (MAX(num)-7),7"); Does this > >> work or am I way off? > > > > It won't work. The arguments to LIMIT must be constants. > > > >> > > Statements like this work in PHP: > > $limitBegin= (MAX(num)-7); > > /* > I did not test MAX(num), you may have to make a seperate query to get > this value > */ > > $limitEnd = 7; > > $selectAllSQL =" > SELECT * FROM > $theTable > LIMIT ($limitBegin, $ limitEnd) > "; > > /* > selectAllSQL is a string. to test echo "selectAllSQL = $selectAllSQL'; > */ > > > $r = mysql_query($selectAllSQL); > > > Hope this helps: > Chris > > > -- > Chris Adams > Cypress Lake Studios > Hypermedia, Quicktime, and Internet Design > http://www.cypresslakestudios.com > [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php