Search the Community
Showing results for tags 'view_users.php'.
-
I have a quick question about chapter 10, script 10.1 view_users.php; I updated the view_users.php via the script 10.1, when I executed the script, the Labels did not line up properly; Last Name, First Name, Registration Date is not in the appropriate place, they are to the far left, right below Edit. I have not made any changes to the script or to the css that I have downloaded from this site. The last view_users was visually correct and so is the home page. I am not sure why these labels are out of place and unsure of how to correct them. The books say to align to the left but I believe that is referring to inside of its header. Edit & Delete are in their respectable places. <?php # script 9.6 - view_users.php // This script retrieves all the records from the users table $page_title = 'View the Current Users'; include ('include/header.html'); // Page header echo '<h1>Registered Users<h1>'; require ('mysqli_connect.php'); // connect to database // DEFINE the query Make the query: /* original script below $q = "SELECT CONCAT(last_name, ', ', first_name) AS name, DATE_FORMAT(time, '%M %d, %Y') AS dr FROM users_info ORDER BY time ASC"; */ // make/define the query $q = "SELECT last_name, first_name, DATE_FORMAT(time, '%M %d, %Y') AS dr, user_id FROM users_info ORDER BY time ASC"; $r = @mysqli_query ($dbc, $q); // Run the query $num = mysqli_num_rows($r); if ($num > 0) { // If it ran OK, display the records. echo "<p>There are currently $num registered users</p>\n"; // Table header echo '<table align="center" cellspacing="3" cellpadding="3" width="75%"> <tr> <td align="left"><b>Edit</b></td> <td align="left"><b>Delete</b></td></tr> <td align="left"><b>Last Name</b></td></tr> <td align="left"><b>First Name</b></td></tr> <td align="left"><b>Date Registered</b></td> </tr> '; // Fetch and print all the records: while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) { echo '<tr> <td align="left"><a href="edit_user.php?id=' . $row['user_id'] . '">Edit</a></td> <td align="left"><a href="delete_user.php?id=' . $row['user_id'] . '">Delete</a></td> <td align="left">' . $row['last_name'] . '</td> <td align="left">' . $row['first_name'] . '</td> <td align="left">' . $row['dr'] . '</td> </tr> '; } echo '</table>'; // Close the table mysqli_free_result ($r); // Free up the resources. } else { // If no records were returned // public message: echo '<p class="error">There are currently no registered users. Step yo game up!</p>'; //Debugging message: // echo '<p>' . mysqli_error($dbc) . '<br /><br />Query: ' . $q . '</p>'; } // End of if ($r) IF. mysqli_close($dbc); // close the data connection. include ('include/footer.html'); ?> Thank you
-
On the view_users.php page, when you click on the "Edit" link you are redirected to another page using the user_id being passed to next page within the URL. On page 260 we are told of the first method in which uses the hidden input type for forms, how can we apply this method to the "Edit" link hyperlink and what adjustments would need to be made to the view_users.php script to allow this ?
- 7 replies
-
- view_users.php
- user_id
- (and 4 more)