SunQuest
           Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old November 24th, 2003, 09:59 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
Order By help!

I have a kindof stupid question that would seem very obvious to anybody but me Xx Anyway here we go.. Here is my piece of code:

php Code:
Original - php Code
  1.  
  2.  
  3. <?php
  4. $db = mysql_connect("localhost", "***", "****");
  5. mysql_select_db("database",$db);
  6. $query = mysql_query("SELECT horsename from horsedata ORDER BY points DESC");
  7. $rows = mysql_fetch_array($query);
  8. echo "$rows[horsename]";
  9. ?>
  10.  


But I get this error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/arabq/public_html/tophorses.php on line 14


Any ideas?

Reply With Quote
  #2  
Old November 24th, 2003, 11:30 PM
honcho's Avatar
honcho honcho is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Cape Cod
Posts: 1,347 honcho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 2 sec
Reputation Power: 3
RE: Order By help!

Looks like your query failed for some reason.
Try this and see where the error is:
php Code:
Original - php Code
  1.  
  2. $db = mysql_connect("localhost", "***", "****");
  3. if(!$db) exit("Could not connect: ".mysql_error());
  4.  
  5. if(!mysql_select_db("database",$db)) exit("Could not select DB: ".mysql_error());
  6.  
  7. $query = mysql_query("SELECT horsename from horsedata ORDER BY points DESC");
  8. if(!$query) exit("Error in query: ".mysql_error());
  9.  
  10. $rows = mysql_fetch_array($query);
  11. echo "$rows[horsename]";

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Order By help!


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 4 hosted by Hostway