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
1
vote
3 answers

Using array in php query?

i want to obtain number of rows in query using mysql_num_rows.the query itself contains 2 arrays. i want to store the number in array. Here's my code $antecedent=array(); for($i=0;$i<=$index;$i++){ if(isset($period[$i])|| isset($gpa[$i]) ||…
aTFa
  • 33
  • 1
  • 7
1
vote
4 answers

How can I solve this mysql_num_rows error

This is the code I am working with
aurel
  • 3,082
  • 10
  • 44
  • 56
1
vote
2 answers

php and mysql_num_rows not detecting if something isnt in the database

I have a form on a website that needs validating before entering the form data into the database. Its checking whether a username already exists by user the mysql_num_rows function. But i cannot seem to get it working. When testing, it doesn't let…
Ryan Jones
  • 447
  • 1
  • 5
  • 14
1
vote
3 answers

Adding Row Number on SQL SELECT

Okay this is going be probably very simple, but I've spent 4 hours on this and I'm giving up to ask what I'm missing. I am doing an SQL SELECT statement: "SELECT username, id, Days FROM Users ORDER BY Days DESC"; Very simple. But now, when…
1
vote
1 answer

Mysql Query - if three values exist in one row?

I have a table, id / category / extra / another I would like to check a row in the table for duplicate entries. for example: services / plumbing / residential The above can only exist once. But... construction / plumbing / residential The above can…
jonnypixel
  • 327
  • 5
  • 27
1
vote
1 answer

Mysqli Prepared Stmt returns 0 num_rows

Help. I am getting 0 num_rows but if i execute the query in the console i am getting results. I m kinda new to prepared stmts. Here is my code Database connection class: class DbConnection { const HOST = "localhost"; const USR = "root"; const PWD…
Redgren Grumbholdt
  • 1,115
  • 1
  • 19
  • 36
1
vote
1 answer

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

if(mysql_num_rows($result)) { echo "no match found!"; } it is throwing an error- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\Hosting\6448289\html\includes\getQuestion.php on line 72
ppp
  • 259
  • 2
  • 8
  • 11
1
vote
2 answers

num_rows method not bringing back number of selected rows

This is the code: $q = $this->db->prepare("SELECT id FROM `users` WHERE username=? AND password=? LIMIT 1"); $q->bind_param('ss', $username, $password); $q->execute(); printf('Rows returned: %i', $q->num_rows); I am using MySQLi to try and check a…
Will
  • 10,731
  • 6
  • 22
  • 16
1
vote
3 answers

Fatal error: $this->db->where()->join()->num_rows()

I want to make codeigniter pagination with where db query. My model: (update) public function get_all_produk_row($url = ''){ data = array(); $this->db->where(array('kategori.url'=>$url,'produk.status_produk'=>'1')); …
Vinsens
  • 199
  • 6
  • 19
1
vote
1 answer

Codeigniter num_row returns "array" instead of number

Alright, Im trying to count all the rows where "Membership_Status" = Active. The result I get right now is "Array" instead of a number. Here is my model class Report_model extends Model { function count_members() { $query =…
JonYork
  • 1,223
  • 8
  • 31
  • 52
1
vote
1 answer

MySQL select works in phpMyAdmin but my PHP returns no rows with the same call

Heres my code '; // debugging $search_word = $_GET['search_word']; $search_word = mysql_escape_string($search_word); …
Latency
  • 176
  • 8
1
vote
3 answers

PHP check if form is already submitted using num rows

I know the problem, But I cannot seem to fix it, and I was hoping someone on here could steer me in the right direction, What I want to do is check to see if a user has already submitted a correct answer to a question before checking it against the…
Keiththolt
  • 57
  • 8
1
vote
1 answer

mysqli num_rows does not return correct number of rows - all values checked

I'm trying to show icon.envelop.2.gif if there are any messages with message_status = 2. However for some obscure reason this query returns 0. What have I missed here? The $_SESSION['user_id'] is valid, and so is $access_level. I have checked my…
Gjert
  • 1,069
  • 1
  • 18
  • 48
1
vote
1 answer

mysql_num_rows result order

This is a question regarding the mysql_num_rows command. Basically what I want to ask if it's possible to sum the results up and order them in a descending order. $fetchrank = mysql_query("SELECT * FROM leden WHERE level = 6 OR level = 106"); …
1
vote
0 answers

mysql_num_rows returns 0, but the SQL returns normal values

$getPrd = mysql_query("SELECT * FROM products LEFT OUTER JOIN productscontent ON productscontent.productsID = products.id WHERE productscontent.title LIKE '%".$search."%' OR productscontent.alltext LIKE '%".$search."%' ORDER BY…
Xeen
  • 6,955
  • 16
  • 60
  • 111
1 2
3
12 13