Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require "Conn.php";
- ?>
- <?php
- $db = mysqli_connect('', '', '', '') or die('Error connecting to MySQL server.');
- ?>
- <?php
- $servername = "";
- $username = "";
- $password = "";
- $database = "";
- if (mysqli_connect_errno()){
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
- $conn = new mysqli($servername, $username, $password, $database);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- if(mysqli_connect_errno()){
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
- $sql = "SELECT * FROM view";
- $result = mysqli_query($conn, $sql);
- if (mysqli_num_rows($result) > 0) {
- // output data of each row
- while($row = mysqli_fetch_assoc($result)) {
- echo "<table border = 5>";
- echo "<tr>";
- echo "
- <th>RID</th>
- <th>BID</th>
- <th>Viewing</th>";
- echo "</tr>";
- while($row = mysqli_fetch_array($result)){
- echo "<tr>";
- echo "<td>" . $row['RID'] . "</td>";
- echo "<td>" . $row['BID'] . "</td>";
- echo "<td>" . $row['Viewing'] . "</td>";
- echo "</tr>";
- }
- echo "</table>";
- }
- } else {
- echo "0 results";
- }
- echo "$result";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement