Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Get data
- $hostname = "79.170.44.85";
- $username = "cl40-rrich";
- $password = "73U/Xg-wE";
- $dbName = "cl40-rrich";
- echo '<h1 id="mainhead">Registered Users</h1>';
- $conn = @mysqli_connect ($hostname, $username, $password) or die ("Sorry - unable to connect to MySQL database.");
- $rs = @mysqli_select_db ($conn, $dbName) or die ("error");
- // Make the query.
- $query = "SELECT UserID, LoginName, Password1 FROM User ";
- $result = mysqli_query ($conn, $query); // Run the query.
- $num = mysqli_num_rows($result);
- if ($num > 0) { // If it ran OK, display the records.
- echo "<p>There are currently $num users.</p>\n";
- // Table header.
- echo '<table align="center" cellspacing="0" cellpadding="5">
- <tr>
- <td align="left"><b>Edit</b></td>
- <td align="left"><b>Delete</b></td>
- <td align="left"><b>ID</b></td>
- <td align="left"><b>username</b></td>
- <td align="left"><b>password</b></td>
- </tr>';
- // Fetch and print all the records.
- while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
- echo '<tr>
- <td align="left"><a href="edituser1.php?id=' . $row['UserID'] . '">Edit</a></td>
- <td align="left"><a href="deleteuser.php?id=' . $row['UserID'] . '">Delete</a></td>
- <td align="left">' . $row['UserID'] . '</td>
- <td align="left">' . $row['LoginName'] . '</td>
- <td align="left">' . $row['Password1'] . '</td>
- </tr>';
- }
- echo '</table>';
- mysqli_free_result ($result); // Free up the resources.
- } else { // If it did not run OK.
- echo '<p class="error">There are currently no registered users.</p>';
- }
- mysqli_close(); // Close the database connection.
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- <link rel="stylesheet" href="style.css" style text ="style/css">
- </head>
- <body>
- <td><a href = "protected.php" class = "onpage">Go Back</a></td>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement