Questions tagged [mysql-num-rows]

Retrieves the number of rows from a result set.

mysql_num_rows($resultSet) is used to retrieve the number of rows in $resultSet.

It should only be used on a result set generated from a query that produces an actual set of results, such as SELECT. If you want to get the number of rows affected by an UPDATE, DELETE, or INSERT, you should use mysql_affected_rows instead.

It will return the number of rows in the rowset; or boolean FALSE on failure.

Note that as of PHP 5.5.0, this function has been deprecated.

181 questions
0
votes
2 answers

mysql_num_rows and mysql_affected_rows return the same result when executing SELECT SQL

My test code: $connection = mysql_connect('localhost', 'root', '') or die(mysql_error()); mysql_select_db("chaoge", $connection); mysql_query("SET NAMES UTF8", $connection); $rs = mysql_query("SELECT * FROM babel_node WHERE…
tripleCC
  • 39
  • 8
0
votes
2 answers

Need to Display the Results of MySQLi num_rows in Separate Table from Array Results

I have a page that displays a MySQLi query result array. On this page the data comes to the page correctly but for my $result['rows'] which is the result of num_rows of the array results are showing up for each record and then the array results are…
Derek
  • 27
  • 4
0
votes
1 answer

mysql_num_rows doesn't work when there are no rows

First off, yes, I know mysql_num_rows() is deprecated. Now, continuing on to the actual question, I'm making a page where users can post things and other users can like them. But when the post displays, and the user viewing them didn't/hasn't liked…
kzhao14
  • 2,470
  • 14
  • 21
0
votes
0 answers

prepared mysqli statement - always returns 0 for num_rows

I've been working for the past hour on this one prepared statement. It returns 0 for the num_rows every time. I've run the query through my database manually in phpmyadmin and there's nothing wrong with it. And $user_id is set fine as well. if…
Amy Neville
  • 10,067
  • 13
  • 58
  • 94
0
votes
1 answer

mysql_num_rows return always zero when I use polish letters

so I have little problem, because I need to check if "product" exists in database, and if not, I want to create one. I was doing something like this: $tekst2 = "SELECT * FROM product WHERE nazwa = '$nazwa'"; $id_zap2 =…
Mateusz
  • 323
  • 2
  • 11
  • 23
0
votes
2 answers

num_rows not working in Object Oriented method

I'm a beginner in php & mysql. The num_rows is not working in the below basic example. The whole script is inspired by the example in w3schools. w3schools example. the browser shows an error message as follows. Notice: Trying to get property of…
Wajahath
  • 2,827
  • 2
  • 28
  • 37
0
votes
2 answers

mysql_num_rows in laravel 5

im trying to make an option for an admin, to choose in which order to show the categories in the website. so in the control panel, he has an up arrow and a down arrow next to each category's title. if he clicks down, the category goes down in one…
TheDragoner
  • 273
  • 2
  • 6
  • 17
0
votes
0 answers

mysql_num_rows returning bad value

I need help to solve a problem. I have this script twice on my page in two diffrent divs. The first script works fine and the second also, but when i run the script at the same time on the page only the first script works.When it work it returns 1…
Quarskel
  • 27
  • 4
0
votes
1 answer

For loop not executing when num_rows returns 1

I'm experiencing an issue with a for loop in the following code:
0
votes
2 answers

Trouble printing items from a database

I keep getting an error on line 20, "if(mysqli_num_rows != 0)". The error reads: "Notice: Use of undefined constant mysqli_num_rows - assumed 'mysqli_num_rows' in C:\wamp\www\movieDB\movies.php on line 20" It's probably just a stupid mistake that…
0
votes
2 answers

mysql_num_rows causes an error message

My simplified code is: I get the following error: "Warning: mysql_num_rows() expects parameter 1…
deotpit
  • 95
  • 1
  • 3
  • 12
0
votes
1 answer

Ajax, Update div with num_rows

I've built a notification system, and its almost working. I just have one niggly bit that I can't seem to get my head around. When a new update comes in from a friend it prints out the number of new notifications as expected, only if a user posts…
Dave
  • 97
  • 10
0
votes
1 answer

Directive 'register_long_arrays,how to modify?mysql_num_rows() expects parameter 1 to be resource, boolean given

Directive 'register_long_arrays, in Php 5.3.28, warning appear : mysql_num_rows() expects parameter 1 to be resource, boolean given in xxx/mysql.php on line 534 534 which refer to this row :$count = mysql_num_rows($resource); function…
0
votes
2 answers

myqli_num_rows not returning zero

Does anyone know why the following mysqli_num_rows is NOT returning zero when there are no results? Instead of displaying the '0' character it simply displays nothing. Totally baffled. EDIT << msqli_num_rows is working correctly and display a number…
Phil Howell
  • 79
  • 2
  • 8
0
votes
1 answer

wordpress query num_rows won't return value

I try to get number of rows per query in my wordpress Class but I get each time null, what is wrong with the following class MyClass{ private $wpdb; private $query; public function __construct(){ global $wpdb; …
fefe
  • 8,755
  • 27
  • 104
  • 180