php - finding number of rows affected or retrieve
Get the solution ↓↓↓i am have problems with retrieving the number of rows affected or retrieved from the database. when I check the value of $myslqi->affected_rows it has very unexpected values.
{-code-1}
in this code the affected rows says-1
however there is value in database.. how to check the number of rows in my case
Answer
Solution:
affected_rows
returns the number of rows affected by the last INSERT, UPDATE, REPLACE or DELETE query.
In order to get the number of rows in the result, you need to get themysql_result
object. Try this instead:
$stmt->get_result()->num_rows
Answer
Solution:
callingaffected_rows
after a select statement will return the same value asnum_rows
-1 fromaffected_rows
means that there was an error try callingerror
on the mysqli object and looking at what the error was (if there is one).
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: fastcgi sent in stderr: "primary script unknown" while reading response header from upstream
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.