188 questions
3
votes
5
answers
22k
views
codeigniter v4 num_rows() Call to undefined method
Num rows not found in the documentation Codeigniter 4.
My method in my model:
public function getListCat()
{
$listCat = $this->asArray()->where(['id_user' => $session->id])->get();...
-1
votes
1
answer
44
views
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.
...
0
votes
3
answers
1k
views
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 ...
1
vote
3
answers
11k
views
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 ...
-1
votes
5
answers
776
views
Why does CodeIgniter's affected_rows() returns 0 after a SELECT query? [closed]
I have a query command which run in mysql tools.
SELECT *
FROM t_table1
WHERE id=18888
but when I try to execute this command in PHP CodeIgniter, but there are no rows returned.
I tried to get the ...
0
votes
2
answers
1k
views
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 = ...
0
votes
0
answers
54
views
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 ...
0
votes
1
answer
528
views
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 ...
6
votes
2
answers
2k
views
PHP- mysqli->num_rows always returns 0, Prepared statements
First of all I would like to tell that I have already gone though ALL DUPLICATE questions. and tried the changes suggested there.
As far as now I have already tried changing num_rows to num_rows()
...
1
vote
1
answer
433
views
Mysqli Prepared Stmt returns 0 num_rows [duplicate]
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 ...
-2
votes
2
answers
2k
views
Mysqli num_rows() returns nothing/null after executing INSERT query [duplicate]
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')...
0
votes
2
answers
449
views
SELECT PHP and MySQL not working
I have this code for the select and printing values.
mysql_numn_rows returns null :/
<?php
mysql_connect('localhost','root','');
mysql_select_db("db2517");
$username = "Cristoforo";
$query = ...
0
votes
1
answer
123
views
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 ...
0
votes
1
answer
130
views
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 ...
0
votes
1
answer
104
views
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 ...
0
votes
2
answers
461
views
How to return the number of rows from a CodeIgniter active record query [duplicate]
I am trying to perform a wildcard search query using CI.
I am checking for loggedin sessions. If a user is logged into more than one device, a popup is displayed. To check if the user is logged in ...
0
votes
0
answers
61
views
What is the most reliable way to check if a successful MySQL query has returned no results?
I want to check if a successful query has returned no results.
When testing this script locally, I make sure that the database does not contain any values the query is seeking, but
mysqli_num_rows($...
0
votes
2
answers
33
views
num_rows always gives back that there are no rows (that are equal to my input) in the database which isn't true
I'm trying to find out if the title someone filled in in a form is already in the database (cause otherwise I'm going to add a number to the title). But somehow the code underneath always give back "...
1
vote
2
answers
1k
views
"Notice: Undefined property: CI_DB_mysqli_result::$num_rows" when accessing num_rows of a CodeIgniter result set object [duplicate]
I am trying to execute a select query in CodeIgniter like below:
public function validate()
{
$username = $this->security->xss_clean($this->input->post('username'));
$password = $...
0
votes
1
answer
30
views
Check whether there is an entry in a result from mysql_query via php [duplicate]
I'm very new here as well as in php and mysql and I hope you can help me :)
I'm trying to build a JSON for a visualization using data from a database.
My problem is, that it doesn't passes the if-...
0
votes
2
answers
128
views
Show how many rows of results a CodeIgniter query has
I do have a search form on a page which search records from a table in my database. I want to show how many results each query gives us. All this is written in codeigniter.
All my code on that page:
&...
-3
votes
1
answer
53
views
OO MYSQLI num_rows always = -1
I want to just check if the username already exists within the database for my signup page, to do this I figure I can just do a select query with the input username and see how many results I get back....
7
votes
1
answer
23k
views
mysql_num_rows in laravel?
im trying to use mysql_num_rows in laravel but laravel says it not the same way like in 'raw php'
example:
$users = DB::table('users')
->where('username', '=', $username)
->...
0
votes
1
answer
90
views
mysql_num_rows gives waring when no data found in database
I have a query which perform fine, but the problem is somehow its gives me the warning when no data match from database.
$count = mysql_num_rows($qry); //warning here
I can use @ to hide the error, ...
0
votes
2
answers
116
views
num row isnt detecting row in table
I'am currently making a login system for news website as part of my coursework. For some reason when I use $rows->num_rows == 1 in an if statement, it always runs the "else" code. Basically this means ...
0
votes
1
answer
474
views
fetchColumn error on PDO while trying to get number of rows
I'm trying to move to PDO.
I want to do a classic query for checking number of rows, in mysql I would have done mysql_num_rows_result but I've read somewhere that in PDO it does not work.
So I've ...
0
votes
6
answers
104
views
Select the latest version based on date for each ID in MYSQL
I have a table like:
+------------+-------------------+--------------+------------+
| listing_id | transaction_title | image_thumb | sale_date |
+------------+-------------------+--------------+----...
1
vote
3
answers
609
views
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,'...
0
votes
1
answer
37
views
Mysql Query "OR" and "AND"
$assault_checker=mysql_query("SELECT * FROM assaults WHERE host_id='".$_SESSION['user']."' OR guest_id='".$_SESSION['user']."' AND status='0'");
$assault_checker=mysql_num_rows($assault_checker);
I ...
0
votes
1
answer
53
views
MySQL Numrows Expecting Parameter
So I'm Getting The Error:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\All Connected\profile.php on line 117
While Try To Check For Friend Request ...
1
vote
3
answers
466
views
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 ...
0
votes
2
answers
138
views
mysql_num_rows and mysql_affected_rows return the same result when executing SELECT SQL
My test code:
$connection = mysql_connect('localhost', 'root', '') or die(mysql_error());
mysql_select_db("chaoge", $connection);
mysql_query("SET NAMES UTF8", $connection);
$rs = ...
-1
votes
3
answers
207
views
Search Button in php No Result error message
I'm having trouble where should i put my echo 'No Result Found'; in the code code I tried putting it in the last else statement together in code for debugging but it doesn't work. Please help where ...
2
votes
0
answers
30
views
mysqli_num_rows works with value but returns error when empty [duplicate]
I try to create an if / else action, based on the number of rows in my DB.
$gekoppeldeDB = $_POST['gekoppeldeDB'];
$sql_bon = mysqli_query($mysqli, "SELECT * FROM $gekoppeldeDB");
$rowcount = ...
3
votes
3
answers
371
views
mysql_num_rows isn't returning any rows
So, I have some code. I know that mysql_num_rows is deprecated, but since I've already used it I don't want to switch everything to mysqli_. Anyway it was working on my local server and returning 1 or ...
0
votes
2
answers
158
views
Need to Display the Results of MySQLi num_rows in Separate Table from Array Results
I have a page that displays a MySQLi query result array. On this page the data comes to the page correctly but for my $result['rows'] which is the result of num_rows of the array results are showing ...
0
votes
1
answer
89
views
Count number of qualifying rows from a query in a CodeIgniter application [duplicate]
$sql=SELECT COUNT( * ) FROM attendance3 WHERE name = 'Hema' AND attend = 'Absent' AND MONTH = 'July' AND year = '2015' AND user = 'mars'.
In php we can get the count
$res = mysql_query($sql);
$row = ...
0
votes
1
answer
116
views
mysql_num_rows doesn't work when there are no rows
First off, yes, I know mysql_num_rows() is deprecated.
Now, continuing on to the actual question, I'm making a page where users can post things and other users can like them. But when the post ...
1
vote
1
answer
337
views
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 ...
0
votes
1
answer
76
views
mysql_num_rows return always zero when I use polish letters
so I have little problem, because I need to check if "product" exists in database, and if not, I want to create one. I was doing something like this:
$tekst2 = "SELECT * FROM product WHERE nazwa = '$...
1
vote
1
answer
280
views
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 * ...
1
vote
0
answers
424
views
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 ...
0
votes
2
answers
14k
views
num_rows not working in Object Oriented method [duplicate]
I'm a beginner in php & mysql. The num_rows is not working in the below basic example.
The whole script is inspired by the example in w3schools.
w3schools example.
the browser shows an error ...
0
votes
2
answers
5k
views
mysql_num_rows in laravel 5
im trying to make an option for an admin, to choose in which order to show the categories in the website.
so in the control panel, he has an up arrow and a down arrow next to each category's title. ...
-1
votes
2
answers
185
views
mysql_num_rows comparison operator
Edit Note: There was nothing wrong with this comparison operator. I was asked to expound, so added the code below. As it turned out, the problem was in the UniqueID function I was using to create a ...
0
votes
0
answers
83
views
mysql_num_rows returning bad value
I need help to solve a problem. I have this script twice on my page in two diffrent divs. The first script works fine and the second also, but when i run the script at the same time on the page only ...
0
votes
1
answer
240
views
For loop not executing when num_rows returns 1
I'm experiencing an issue with a for loop in the following code:
<?php
// connect to database and establish $link, okay
// log in user if possible and get $userID, okay
// if logged in, get list ...
-5
votes
1
answer
234
views
How to choose page using if else in mysql_num_rows
Please help me I want my program to choose a site if it has not yet username then it will proceed it to ch_uname.php. Then if the login credentials have already username then it will be preceded to ...
0
votes
2
answers
528
views
Trouble printing items from a database
I keep getting an error on line 20, "if(mysqli_num_rows != 0)". The error reads:
"Notice: Use of undefined constant mysqli_num_rows - assumed 'mysqli_num_rows' in C:\wamp\www\movieDB\movies.php on ...
-3
votes
1
answer
120
views
PHP log in not working num_rows
I have a problem with my script: i believe mysql_num_rows won't find anything from my database even though i know there is something in there (two records actually).... Anyone help?
<?php
$con = ...