mysql-num-rows

Ordering by number of rows?

Alright, so I have a table outputting data from a MySQL table in a while loop. Well one of the columns it outputs isn't stored statically in the table, instead it's the sum of how many times it appears in a different MySQL table. Sorry I'm not sure this is easy to understand. Here's my code: $query="SELECT * FROM list WHERE added='...

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

Heres my code <?php session_start(); include('config.php'); if(isset($_GET['search_word'])) { // echo $_GET['search_word'] . '<br />'; // debugging $search_word = $_GET['search_word']; $search_word = mysql_escape_string($search_word); $search_word_fix = str_replace(" ","%",$search_word); $query = "SELECT * FROM art...

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 = $this->db->get_where('Membership', array('Membership_Status' => 'Active')); return $query->num_rows(); } ...

Num Rows always ='s 1 for some reason. QUICK FIX

I don't know if i am doing it right, this is what I got: while($row = mysqli_fetch_assoc($result)) { $items = mysqli_num_rows($row); } It always sets $items = to 1 for some reason. Here is my mysqli_query... $top10_query = "SELECT * FROM users WHERE userid='$userid'"; $result = mysqli_query($cxn, $top10...

mysql_num_rows for an mysql object?

Hi. How do I find mysql_num_rows for an object. This gives an error: $query = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_object($query); echo mysql_num_rows( $row ); Warning: mysql_num_rows() expects parameter 1 to be resource, object given ...

mysql_num_rows returns 0, but the same query in phpMyAdmin return results

Hello all, We have been working for a few hours on a serious problem. We have the following code: mysql_connect("localhost","xxx","xxx") or die(mysql_error()); mysql_select_db("xxxe"); $q = "SELECT m.id, m.expired_date, u.email FROM jos_osemsc_member m, jos_osemsc_orders o, jos_users u WHERE o.order_id = $orderID AND m.m...

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 users login credentials. Everything works and the query gets executed and data is retur...

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 ...

[PHP MYSQL] Password Changer [Warning: mysql_num_rows() expects parameter 1 to be resource]

I am using simple self-created php script to change password to my wow server's website. Here's the error: "Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in D:\wamp\www\password.php on line 24" Password script: if (isset($_POST['submit'])){ change_db($realm_DB); $loginusername = "$acc_...

mysql_num_rows always returns 1

The result is always 1: $sql = 'SELECT COUNT(Vote) FROM ' . $table; $res = mysql_query($sql, $conn); $vote_total = mysql_num_rows($res); I ran the $sql query in phpMyAdmin and it returns 3, so the query is not the problem. $vote_total is initialized globally to 0, so that 1 is coming from somewhere. What other information do I need to...

php + mysql_num_rows

is there a more efficient way of doing the following? $total_a = mysql_query("SELECT `id` FROM `table` WHERE `this` = 'that'"); $total_b = mysql_num_rows($total_a); if(!$total_b) { echo 'no results'; } else { $a = mysql_query("SELECT `id`, `time` FROM `table` WHERE `this` = 'that' ORDER BY `time` DESC"); while($b = mysql_fe...