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:
  #1  
Old November 29th, 2002, 07:09 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: 25
Simple problem... I hope

I'm a total newbie using a very simple PHP script to pull nicknames and scores from a MySQL database, to display in an html scoreboard, but I'm getting an error message each time :-(

This is the piece of code that's causing the problem:

$query = "SELECT nickname,score FROM sms_billiards ORDER BY score DESC limit 20";

$result = @mysql_query($query);

$numPlayers = mysql_num_rows($result);

for($count=0; $count<$numPlayers; $count++)
{
$nick = mysql_result($result,$count,"players");

$score = mysql_result($result,$count,"scores");
?>
<tr>
<td width="40">
<div align="left"><b><font face="Verdana" size="2" color="#FFCC00"><?php echo($count+1); ?></font></b></div>
</td>
<td width="225">
<div align="left"><b><font face="Verdana" size="2" color="#FFCC00"><?php echo($nick); ?></font></b></div>
</td>
<td width="225">
<div align="left"><b><font face="Verdana" size="2" color="#FFCC00"><?php echo($score); ?></font></b></div>
</td>
</tr>
<?php
}
?>

It keeps giving me the following message:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:dhoybinapachehtdocsrich2.php on line 112

Line 112 is the line: $numPlayers = mysql_num_rows($result);

ANY help much appreciated.

rich@mousebreaker.co.uk

Reply With Quote
  #2  
Old November 30th, 2002, 12:40 AM
brut brut is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 367 brut User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 12 sec
Reputation Power: 3
RE: Simple problem... I hope

Have you selected a database? Either way,
try replacing:
Code:
$result = @mysql_query($query);

with this:
Code:
$result=mysql_query($query) or die("MySQL Error No. ".mysql_errno().": ".mysql_error());

This will give you a description of what is wrong with you're query.

Reply With Quote
  #3  
Old November 30th, 2002, 11:10 AM
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: 25
RE: Simple problem... I hope

Excellent. Identified the problem.

Thanks for your help :-)

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Simple problem... I hope


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




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

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




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek