General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 6th, 2003, 07:58 PM
velocityX velocityX is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 72 velocityX User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 36 sec
Reputation Power: 6
Send a message via AIM to velocityX
help with select max()

This isnt selecting the max downloaded file and i cant get max() to work in this script.

PHP Code:
<?
mysql_connect
('localhost',*****,*****);
mysql_select_db(coldxice_forum);

$select_max_downloaded "select * FROM csv_maps order by downloaded and mapid DESC LIMIT 1";
$mostdownloaded_result mysql_query ($select_max_downloaded);


$mostdownloaded mysql_result($mostdownloaded_result,0"mapname");
$mostdownloadedcount mysql_result($mostdownloaded_result,0"downloaded");

        
$mostdownloaded_len strlen($mostdownloaded) - 4;
        
$mostdownloaded_name substr($mostdownloaded,0,$mostdownloaded_len);

?>

Reply With Quote
  #2  
Old October 7th, 2003, 07:05 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
So what IS it doing? Is there a pattern? Does it always get the same result (the minimum, say)? What kind of error did max() give you (a group by error, I imagine)?

Reply With Quote
  #3  
Old October 7th, 2003, 08:20 AM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
Try this..

PHP Code:
 $select_max_downloaded "select * FROM csv_maps WHERE downloaded = (SELECT MAX(downloaded) FROM csv_maps"
__________________
-- Jason

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > help with select max()


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT