Jump to content
Larry Ullman's Book Forums

PHPMYSQL4 SCRIPTS CHAP 10 view_users.php


Recommended Posts

Chap 10. Script 10.1 - view_users.php
Line 5, 6, and 7 of source code.
$row['last_name'] turns into "view_users.php?sort=ln" in
the source code. I don't understand how the info is obtained other than this is how a query works. view_users.php is where the query is made. Yet, it accessed the users table in the database. Is "view_users.php?sort=ln" the $results showing?

Is the query using the get method to supply the
requested info, since there is no form suggesting it's a
post method?

Also, The error_log says that:

include(includes/footer.html): failed to open stream: No
such file or directory.

I noticed there's no HTML header file that is suppose to
be included in the example file package, yet, the page is
presented in source code.

The URL to access it is clearly .php, so how is it I'm
getting to see the source code?

Please Explain.


###########################################################


<h1>Registered Users</h1><table align="center" cellspacing="0" cellpadding="5" width="75%">
<tr>
    <td align="left"><b>Edit</b></td>
    <td align="left"><b>Delete</b></td>
    <td align="left"><b><a href="view_users.php?sort=ln">Last Name</a></b></td>
    <td align="left"><b><a href="view_users.php?sort=fn">First Name</a></b></td>
    <td align="left"><b><a href="view_users.php?sort=rd">Date Registered</a></b></td>
</tr>
<tr bgcolor="#ffffff">
        <td align="left"><a href="edit_user.php?id=1">Edit</a></td>
        <td align="left"><a href="delete_user.php?id=1">Delete</a></td>
        <td align="left">Ullman</td>
        <td align="left">Larry</td>
        <td align="left">February 13, 2014</td>
    </tr>
    <tr bgcolor="#eeeeee">
        <td align="left"><a href="edit_user.php?id=2">Edit</a></td>
        <td align="left"><a href="delete_user.php?id=2">Delete</a></td>
        <td align="left">Isabella</td>
        <td align="left">Zoe</td>
        <td align="left">February 13, 2014</td>
    </tr>
    <tr bgcolor="#ffffff">
        <td align="left"><a href="edit_user.php?id=11">Edit</a></td>
        <td align="left"><a href="delete_user.php?id=11">Delete</a></td>
        <td align="left">Sedaris</td>
        <td align="left">David</td>
        <td align="left">February 13, 2014</td>
    </tr>
    <tr bgcolor="#eeeeee">
        <td align="left"><a href="edit_user.php?id=10">Edit</a></td>
        <td align="left"><a href="delete_user.php?id=10">Delete</a></td>
        <td align="left">Nesmith</td>
        <td align="left">Mike</td>
        <td align="left">February 13, 2014</td>
    </tr>
    <tr bgcolor="#ffffff">
        <td align="left"><a href="edit_user.php?id=9">Edit</a></td>
        <td align="left"><a href="delete_user.php?id=9">Delete</a></td>
        <td align="left">Dolenz</td>
        <td align="left">Micky</td>
        <td align="left">February 13, 2014</td>
    </tr>
    <tr bgcolor="#eeeeee">
        <td align="left"><a href="edit_user.php?id=7">Edit</a></td>
        <td align="left"><a href="delete_user.php?id=7">Delete</a></td>
        <td align="left">Jones</td>
        <td align="left">David</td>
        <td align="left">February 13, 2014</td>
    </tr>
    <tr bgcolor="#ffffff">
        <td align="left"><a href="edit_user.php?id=6">Edit</a></td>
        <td align="left"><a href="delete_user.php?id=6">Delete</a></td>
        <td align="left">Starr</td>
        <td align="left">Ringo</td>
        <td align="left">February 13, 2014</td>
    </tr>
    <tr bgcolor="#eeeeee">
        <td align="left"><a href="edit_user.php?id=5">Edit</a></td>
        <td align="left"><a href="delete_user.php?id=5">Delete</a></td>
        <td align="left">Harrison</td>
        <td align="left">George</td>
        <td align="left">February 13, 2014</td>
    </tr>
    <tr bgcolor="#ffffff">
        <td align="left"><a href="edit_user.php?id=4">Edit</a></td>
        <td align="left"><a href="delete_user.php?id=4">Delete</a></td>
        <td align="left">McCartney</td>
        <td align="left">Paul</td>
        <td align="left">February 13, 2014</td>
    </tr>
    <tr bgcolor="#eeeeee">
        <td align="left"><a href="edit_user.php?id=26">Edit</a></td>
        <td align="left"><a href="delete_user.php?id=26">Delete</a></td>
        <td align="left">Simpson</td>
        <td align="left">Abe</td>
        <td align="left">February 13, 2014</td>
    </tr>
    </table><br /><p>1 <a href="view_users.php?s=10&p=3&sort=rd">2</a> <a href="view_users.php?s=20&p=3&sort=rd">3</a> <a href="view_users.php?s=10&p=3&sort=rd">Next</a></p>

 

Link to comment
Share on other sites

On 8/30/2019 at 2:08 PM, questomni said:

Chap 10. Script 10.1 - view_users.php
Line 5, 6, and 7 of source code.
$row['last_name'] turns into "view_users.php?sort=ln" in
the source code. I don't understand how the info is obtained other than this is how a query works. view_users.php is where the query is made. Yet, it accessed the users table in the database. Is "view_users.php?sort=ln" the $results showing?

That's not what's happening. $row['last_name'] refers to a specific column from a returned row. The sort=ln bit is used in the code to dynamically change the ORDER BY clause. 

On 8/30/2019 at 2:08 PM, questomni said:

Is the query using the get method to supply the
requested info, since there is no form suggesting it's a
post method?

Yes!

On 8/30/2019 at 2:08 PM, questomni said:

Also, The error_log says that:

include(includes/footer.html): failed to open stream: No
such file or directory.

If you're getting that error, you're missing the includes/footer.html file in your web directory.

On 8/30/2019 at 2:08 PM, questomni said:

I noticed there's no HTML header file that is suppose to
be included in the example file package, yet, the page is
presented in source code.

The URL to access it is clearly .php, so how is it I'm
getting to see the source code?

I'm fairly sure there should be a header file, too. I'd double-check the book's directions. It may be re-using a header file from a previous chapter. If you're seeing the source code, it could be because you're not accessing the page through HTTP. 

Link to comment
Share on other sites

 Share

×
×
  • Create New...