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

Storing data from database [mysql_num_rows]

So I have this code to pass items from database to my order table. When I'm echoing the session. The session variable contains something so there's no problem with that. But when I echo those variables under numrows, it only shows nothing. Is there…
user1717305
  • 49
  • 1
  • 5
0
votes
1 answer

count all num_rows, neglecting the limit

Is it possible to count all the rows in a table even if we add a LIMIT on our query? SELECT * FROM table LIMIT 0,10 for example the table contains 100 rows, how can I get that "100" with only one query even if there is a LIMIT on that query?
Sam San
  • 6,567
  • 8
  • 33
  • 51
0
votes
1 answer

MySQL - Return number of rows matching query data?

I have a query as follows: SELECT 1 FROM shop_inventory a JOIN shop_items b ON b.id=a.iid AND b.szbid=3362169 AND b.cid=a.cid WHERE a.cid=1 GROUP BY a.bought The only thing I need to do with this data is work out the number of rows returned (which…
Keir Simmons
  • 1,634
  • 7
  • 21
  • 37
0
votes
1 answer

How to get mysql_num_rows with PDO?

How can I easily get the number of rows returned with "SELECT *" SQL-query? function valid_credentials($db,$name,$pw) { try { $sth = $db->prepare("SELECT * FROM ib_members WHERE name=:val AND pw=:val2"); $sth->bindValue(":val",$name); …
user1627985
  • 87
  • 1
  • 5
0
votes
1 answer

Apache kills mysql? mysql_fetch_object(): supplied argument is not a valid MySQL result resource

So i have a php script that i run directly from the browser and i get 2 errors: Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in... Warning: mysql_num_rows() expects parameter 1 to be resource, boolean…
0
votes
4 answers

PHP error with mysql_num_rows

I have a simple form which when submitted should count the number of rows in a table which already have the same value as that submitted. I can't work out why this is returning an error... any ideas? The error is Warning: mysql_num_rows() expects…
Tom
  • 12,776
  • 48
  • 145
  • 240
0
votes
3 answers

Conditional counting of records

Am trying to calculate the number of rows in a table depending on a certain condition. So, I did manage to write a piece of code that would function as required. But, it's bit too long. So am wondering if there is any easier way to achieve…
Khaled
  • 154
  • 2
  • 8
0
votes
3 answers

mysql_numrows() error in MySQL Query Web Page Display

I am writing a web page that selects certain fields from a database that meet a criteria. A connection to the database is made, but nothing displays in the table but the header. In the Apache2 logs I see [Mon May 07 01:30:21 2012] [error] [client…
Ross
  • 173
  • 1
  • 2
  • 12
0
votes
2 answers

JQuery Validation Remote and Checking DataBase PHP MySQL Error

I am using the JQuery Validation Plugin. I got the remote function working with the default php file. I modified the php file to use my own version but mysql is returning Warning: mysql_num_rows(): supplied argument is not a valid MySQL result…
Ray
  • 894
  • 1
  • 6
  • 23
0
votes
4 answers

mysql_num_rows in the error log

I am encountering an error. My log is as follows: PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/domain/public_html/index.php on line 96 My code is as followsL line…
Dima Deplov
  • 3,688
  • 7
  • 45
  • 77
0
votes
4 answers

num_rows is 0 when it should be >0 for php mysqli code

My num_rows is coming back as 0, and I've tried calling it several ways, but I'm stuck. Here is my code: $conn = new mysqli($dbserver, "dbuser", "dbpass", $dbname); // get the data $sql = 'SELECT AT.activityName, AT.createdOn …
jpporterVA
  • 629
  • 2
  • 7
  • 20
-1
votes
2 answers

mysql_num_rows() gives a BOOL value

I have this query in my PHP: '); while ($comment =…
Frederick Marcoux
  • 2,195
  • 1
  • 26
  • 57
-1
votes
4 answers

mysql_num_rows(): supplied argument is not a valid MySQL result resource in 15

Every time I try to run my script I get this error, saying that mysql_num_rows(): supplied argument is not a valid MySQL result resource. I'm not quite sure why its doing this. My goal is to get it to check to see if the client who logs in is an…
David
  • 389
  • 5
  • 22
-1
votes
1 answer

Sorting by price or rate

So this is my code, but whenever I run this code i get this message (Notice: Trying to get property 'num_rows' of non-object in F:\xampp\htdocs\php\index.php on line 31) and I can't find the problem. I always use num_rows and it works, this is the…
-1
votes
2 answers

mysql_num_rows won't work in PHP7

I am trying to do something new in PHP, counting rows in a MYSQL database. But it keeps spitting out errors as soon as I put echo $rows in it. Can someone please help me? Here is my login code.
Daan Hermans
  • 31
  • 10