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 March 19th, 2005, 07:08 AM
vmoss1 vmoss1 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 1 vmoss1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 36 sec
Reputation Power: 0
Unhappy Warning: mysql_num_rows()

Hi folks,

I'm new to this forum, and to the world of MySQL. I'll openly admit that I'm completely out of my depth on this one, but maybe one of you will be kind enough to provide some input that may help me.

I have created a database according to the 'foolproof' instructions given with a free resource from http://www.stevedawson.com/propertyplus.php This (PHP PropertyPlus) is for the management of property details. Everything seemed to go according to plan, but there is an error when logging in as follows:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/bulgaria/public_html/admin/index.php on line 32

The relevant section is here:
__________________________________________________ ____________
$validationattempted = false;
include "config.php";
if (isset($_POST["op"]) && ($_POST["op"]=="adminlogin"))
{
mysql_connect($server, $DBusername, $DBpassword) or die ("$DatabaseError");
mysql_select_db($database);
$query = "SELECT * FROM $admin_table WHERE admin_username='".$_POST['admin_username']."' AND admin_password='".$_POST['admin_password']."'";
$result = mysql_query($query);
if (mysql_num_rows($result) >0 )
{
$validationattempted = true;
$validated = true; // assume validation passed
// If username and password are vaild set the cookie
setcookie ("ValidUserAdmin", $_POST['admin_username'],time()+36000); // expire in 1 hour
__________________________________________________ ____________

Oh dear, might just as well be written in Klingon... Can anyone see anything obviously wrong? Line 32 is the 'mysql_num_rows' bit...

Don't know if I've provided enough info here, let me know if you need more and I will attempt to provide it!

Hope to hear from some kind soul, regards,

Vince

Reply With Quote
  #2  
Old March 21st, 2005, 08:52 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
There's a good chance your query failed... add or die() to the end of your mysql_query line
PHP Code:
 $result mysql_query($query) or die("ERROR ".mysql_errno().": ".mysql_error()."<br>\n".$query); 

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Warning: 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 3 hosted by Hostway