|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
There's a good chance your query failed... add or die() to the end of your mysql_query line
PHP Code:
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Warning: mysql_num_rows() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|