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
1 answer

PHP returning strange row counts

i am working with a very large data set (786,432 rows to be precise). So, to prevent memory limits I want to loop over the data set in piles of 50,000 rows, so to test this out I thought I would try: function test(){ $start = 0; $end =…
Hailwood
  • 89,623
  • 107
  • 270
  • 423
0
votes
1 answer

PHP mySQL numRows() usage and errors?

I have the following code that I am using to check for constraints on a database(for a class). U am trying to get the number of rows returned by the query and I keep getting the same error on the line $count1=…
Paul
  • 21
  • 1
0
votes
3 answers

mysql_num_rows error in PHP with mysql_query

Hi i am too new too php and mysql and i want to count the member number due to the search made by user. However, mysql_num_rows doesnt work. mysql_num_rows(mysql_query("SELECT * FROM members WHERE $title LIKE '%$_POST[search]%' LIMIT…
echophp
  • 43
  • 1
  • 1
  • 6
0
votes
1 answer

Break mysql_num_rows into 6x4

Pretty much I have a code like below that I'm trying to add to after every 6 results. echo ""; $query="SELECT * WHERE id='$id' ORDER BY date ASC"; $result=mysql_query($query); if (mysql_num_rows($result) > 0) { while($rts =…
yanike
  • 827
  • 3
  • 13
  • 29
0
votes
3 answers

why is $stmt -> num_rows returning 0 when login exists?

Making a login form and this is my first time using prepared statements. My issue is the num_rows keeps returning 0, despite entering the correct email and password that matches the email and password of my table. I tested that the connection works…
0
votes
2 answers

SELECT count rows from 2 tables and sum the results

I have the PHP code: $query = mysqli_query($mysqli, "SELECT * FROM `table_1`"); $result = mysqli_num_rows($query); $queryTwo = mysqli_query($mysqli, "SELECT * FROM `table_2`"); $resultTwo = mysqli_num_rows($queryTwo); $number = $result +…
Bogdan C
  • 389
  • 1
  • 4
  • 17
0
votes
0 answers

New items after last visit

I have code that supposed to show new items in menu (right of the items.php url). That's not working at all or it shows only one item though there is 10 items. It count's new items and check when your last browse. When you refresh items page "New…
Penalse
  • 175
  • 1
  • 1
  • 8
0
votes
1 answer

PHP / mysqli: Prepared Statements with num_rows constantly returning nothing

In my test-surroundings there is a database containing some Person Information (Name, E-Mail, Adress etc.). These Informations can be inserted by anyone into the database via a form. In the background they are inserted with a parameterized INSERT…
0
votes
1 answer

num_rows() not returning correct number of row when result is not empty

I am working on one Join query in CodeIgniter. Query run perfectly fine. The problem is $query->num_rows().This is how I write my join query. $this->db->select('related colums'); $this->db->from('table1 as t1'); $this->db->join('table2 as t2',…
always-a-learner
  • 3,671
  • 10
  • 41
  • 81
0
votes
3 answers

problems with mysql_num_rows

for some reason i can not understand im having troubles with mysql_num_rows. Heres the script: $notquery = 'SELECT * FROM notification WHERE uid = 1 AND read = 0 AND tipo = post OR tipo = subpost OR tipo = logros'; $notQuery =…
Dan Stern
  • 47
  • 1
  • 2
  • 4
0
votes
2 answers

MYSQLI / PHP: num_rows returns nothing/null

I´ve read many topics with the same problem, but neither of any solved my problem. I´ve got following code: $connection = mysqli_connect('...'); if(mysqli_connect_errno()) { die('Connect Error'); } $connection->set_charset("utf8"); $success =…
user4204019
0
votes
2 answers

SELECT PHP and MySQL not working

I have this code for the select and printing values. mysql_numn_rows returns null :/
Cristoforo
  • 17
  • 3
0
votes
1 answer

Php $num_rows not working after installing Mysqlnd

I'm trying to get my $num_rows working. It had been working, and now it's not. Reading this site it was suggested I install MySqlnd on my server because some things like fetch_array and get_result were not working and now it's like I wish I'd never…
CHarris
  • 2,693
  • 8
  • 45
  • 71
0
votes
1 answer

num_rows returning 0 on a login form

I know this has been discussed but the problem is slightly confusing. I am using mysqli prepared statements, but I also tried with raw queries. num_rows is always 0, and I have no Idea why. As a result of this, the login form is a failure. Below is…
0
votes
1 answer

mysql_query function only works with mysql_num_rows

I have a very strange problem today. I have a section of code which queries a table based on a GET variable passed from a user input (pretty standard). However for this to work I have to include a redundant mysql_num_rows variable.... This Works; …
Benjamino
  • 1
  • 2