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

MySQL number of rows always returning false

I recognize this has been asked multiple times here and I've tried all exhaustible possible solutions. Might there be something inherently incorrect with my query as to why it would return false no matter if my query returns data? $q_log_dates =…
user1040259
  • 6,369
  • 13
  • 44
  • 62
0
votes
2 answers

MySQL: Join number of rows of occurance along with result

I am trying to build a simple private messaging system to my app. The way I have it set up each message has a thread_hash associated with it. Messages that are related to one another have the same thread_hash (messages that are replys to other…
Zaki Aziz
  • 3,592
  • 11
  • 43
  • 61
0
votes
2 answers

MySQL query failed to retrieve data...or something like that

I have just looked at a YouTube video on how to create a custom database. I have tried to implement this into my site. However, obviously, it isn't working... I get an error 'Query failed: ' and nothing more from the following code. // Connect to…
Josh-Mason
  • 319
  • 3
  • 8
  • 22
0
votes
1 answer

Selecting MySQL query via PHP variables

I am getting zero in $booked_num, I tried the query in SQL with values in place of variables, it worked fine. But I don't know where I am making a mistake, please help. I already echoed every variable and everything is fine, but nothing is there in…
user2279942
0
votes
2 answers

INSERT mysql_num_rows as a variable

I am creating a CMS in in which when you ADD NEW PAGE, a display_order will automatically grab the next highest number according to the number of rows already present. Here's what I currently have:
Murphy1976
  • 1,415
  • 8
  • 40
  • 88
0
votes
1 answer

mysql query run only for numbers

$username = $_POST['username']; $password = $_POST['password']; $passworda = $_POST['passworda']; $email = $_POST['email']; if ($password == $passworda){ echo 'this is the user name to be chacked:' .$username .'
'; …
shultz
  • 2,543
  • 3
  • 20
  • 23
0
votes
3 answers

how to assign a value of a query to a variable in zend

I need to calculate the average from a mysql table. So I am taking the sum of a col and dividing it by the number of rows. But the values are not being assigned properly :- $total_sum_query = $db->query("SELECT SUM(marks) FROM markstable WHERE sid =…
Stacy J
  • 2,721
  • 15
  • 58
  • 92
0
votes
1 answer

How can I see if the user's choice in the quiz is correct?

I am trying to check if the answer that the user chose was correct, but it doesn't work properly:
Michael Naidis
  • 116
  • 2
  • 4
  • 15
0
votes
2 answers

Trying to load questions and answers from MySQL shows nothing

In my quiz system I am trying to actually now make the page of the questions, but it shows nothing when I try to show the question rows and the answer rows to the page.
Michael Naidis
  • 116
  • 2
  • 4
  • 15
0
votes
1 answer

MySQL fulltext index search mysql_num_rows returns 1

Correction below! I search a fairly large table for matches with this simple SQL question: $result = mysql_query("SELECT *, MATCH(foretag, stad) AGAINST('$query') AS r FROM tblforetag WHERE MATCH(foretag, stad) AGAINST('$query')"); ...but…
Christian Lundahl
  • 2,000
  • 3
  • 18
  • 29
0
votes
1 answer

Using mysqli_num_rows with while loop and onclick event

I want to echo number of rows(suppose numer of rows= 3).if the user clicks on the number(I am passing 1 parrameter from while loop),then data is alerted But the problem is that if I echo numrows inside while loop then all rows(related 3 rows data…
Aana Saeed
  • 299
  • 1
  • 4
  • 14
0
votes
3 answers

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource with no mysql_error()

I have spent the last hour and a half looking over this code and I cannot figure out what is wrong. It does not return any errors, and the while loops called with the query work fine, but mysql_num_rows will not work. Before I reading the code I…
kira423
  • 325
  • 1
  • 5
  • 26
0
votes
2 answers

mysqli_num_rows = 0 when it should be 1

I've been trying to resolve this problem on my own and for the life of me can't fix it.. //If they are, retreive them from the Person table var_dump($_POST['username']); var_dump($_POST['password']); $select = $this-> doQuery("SELECT * FROM…
Joanne DeBiasa
  • 15
  • 1
  • 1
  • 6
0
votes
2 answers

Repeat Result for num rows in php

Possible Duplicate: i can’t make num rows inside while looping i try allot of to make num rows in while looping to get number of rows for another tables $select_sub_cat = mysql_query("SELECT * FROM sub_cat WHERE ct_id='".$row_main['id']."' LIMIT…
0
votes
2 answers

i can't make num rows inside while looping

i have tow tables first table : For products Second Table : For Categories i want to show in browser like this category1 (20) category2 (5) category3 (3) $select_sub_cat = mysql_query("SELECT * FROM sub_cat WHERE ct_id='".$row_main['id']."'…