MYSQL/PHP PROBLEM?
#1

PHP Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/web2760/public_html/KeeDee/index.php on line 60

PHP Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/web2760/public_html/KeeDee/ucp.php on line 31

PHP Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/web2760/public_html/KeeDee/ucp.php on line 38

mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/web2760/public_html/KeeDee/ucp.php on line 44


Quote:

Line 60: $num_row['MemberN'] = $num_row['Member'];
Line 31: if(mysql_num_rows($result) > 29)
Line 38: if(mysql_num_rows($result) == 0)
line 44: $wa = mysql_num_rows($result);

PS: Before i upload it to a real host, it was working fine on localhost, but when i uploaded it to a web-host it's started to give me those errors..
Reply
#2

mysql_num_rows returns false if it fails for whatever reason (http://php.net/manual/en/function.mysql-num-rows.php). I think the most likely reason here is you put in a bad username/password that you didn't update after you moved the script to the web. Check the database name too, and make sure the user you're using to do the query has all permissions needed to do queries.
Reply
#3

Use mysql_error to get a more explicit message : http://php.net/manual/en/function.mysql-error.php

It's also recommended to move to PDO instead of using the old mysql functions.
Reply
#4

Most likely your connection is dead, also ^.
Reply
#5

First, check the "mysql_query" function.
Linux is case sensitive, not was windows[case insensitive].

Example:
The table name is Table.
In windows, you put "SELECT * FROM `table`" and it will work perfectly.
In Linux, it isn't going to work.

As well, use MySQLi or PDO.
Reply
#6

Quote:
Originally Posted by Kikito
Посмотреть сообщение
First, check the "mysql_query" function.
Linux is case sensitive, not was windows[case insensitive].

Example:
The table name is Table.
In windows, you put "SELECT * FROM `table`" and it will work perfectly.
In Linux, it isn't going to work.

As well, use MySQLi or PDO.
So basically i need to change "SELECT * FROM `table`"? Or i need to convert it to Linux, which i completly don't know how to :/
Reply
#7

Quote:
Originally Posted by Djole1337
Посмотреть сообщение
Most likely your connection is dead, also ^.
And how should it's be dead if the UCP is actually working, but only the login details. My index.php shows a connection to the database, otherwise it's would say failure to login to the database.
Mybad for Double-Post.
Reply
#8

$result probably returns an invalid result, likely because your query isn't working properly. If the query is bad the content of $result will not be a valid resource.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)