Hi guys.
I am currently reading from a php book, and I am in need of some help.
Here is an online link to the book:
http://www.cs.karelia.ru/~musen/php/2013/Books/Beginning%20PHP%205.3%20by%20Matt%20Doyle.pdf
Plz don't worry. This isn't a virus. Its totally safe to view. Its just an online pdf version of a book i am reading.
The specific pages (in the book) I need help with are between pages: 385 - 400.
I could give all of the code, below, but there is quite a lot in total (about 5/6 separate docs, that make up the application, in total). Each document is relatively small, so the problem I am having isn't as bad as it sounds.
The code creates a 'member record viewer'.
Basically, I am just trying to generally read through the code and understand it.
I am in the process of trying to understand the code on page: 390 and 391. The specific document is "member.class.php".
Now, the problem I am having is in relation to the method named: getMembers(). Not to confuse it with the other method - getMember()
The snippet of code I do not understand in getMembers() is:
in the book, it explains:
Once the array of Member objects has been created, the method runs another query. Remember the SQL_
CALC_FOUND_ROWS keyword in the original query? To extract the calculated total number of rows, you
need to run a second query immediately after the original query:
$st = $conn- > query( “SELECT found_rows() AS totalRows” );
$row = $st- > fetch();
The query calls the MySQL found_rows() function to get the calculated total, and returns the result as
an alias, totalRows . Notice that this is a regular query that uses PDO::query() , rather than a prepared
statement as used by the first query. You don ’ t need to use placeholders because the query doesn ’ t need
to contain any passed - in values; hence there is no need to go to the trouble of creating a prepared
statement.
At no point does the book ever explain what this does or what value it holds:
Can someone help?
Paul.