SunQuest
 
           MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

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:
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 October 22nd, 2007, 11:40 PM
bmn bmn is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 25 bmn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 9 m 9 sec
Reputation Power: 0
Problem with mysql_num_rows

hi, i'm new to php and i was trying out some code from a tutorial and i got an error saying: "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\calendar2\index.php on line 30"

heres the code:

[php]
<?php
$sql = "SELECT * FROM appointments WHERE month=10 AND day=1;";
$result = mysql_query($sql);
$numrows = mysql_num_rows($result); //line 30
if($numrows == 0){
echo "<br>available";
}
else{
echo "<br>taken";
}

?>
[php]


An anyone tell me whats wrong? thanks

Reply With Quote
  #2  
Old October 25th, 2007, 02:28 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 364 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 26 sec
Reputation Power: 6
Quote:
Originally Posted by bmn
hi, i'm new to php and i was trying out some code from a tutorial and i got an error saying: "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\calendar2\index.php on line 30"

heres the code:

PHP Code:
<?php 
    $sql 
"SELECT * FROM appointments WHERE month=10 AND day=1;";
    
$result mysql_query($sql);
    
$numrows mysql_num_rows($result); //line 30
    
if($numrows == 0){
        echo 
"<br>available";
    }
    else{
        echo 
"<br>taken";
    }
    
?>



An anyone tell me whats wrong? thanks


PHP Code:
<?php 
    $result 
mysql_query("SELECT * FROM appointments WHERE month=10 AND day=1");
    
$numrows mysql_num_rows($result); //line 30
    
if($numrows == 0){
        echo 
"<br>available";
    }
    else{
        echo 
"<br>taken";
    }
    
?>


Edit, looks like your problem is here,... day=1;";
__________________
-- Jason

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Problem with mysql_num_rows


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