<?php if(isset($_GET['id'])) { require_once 'login1.php'; $id=null; $dbc = null; $conn = new mysqli($hn, $un, $pw, $db); //these three lines connect to the db with the login file if($conn->connect_error) die($conn->connect_error); //all the lines above here will be in all your codes $sql = "SELECT * FROM freshwater WHERE id='$id' "; $result = mysqli_query($dbc, $sql) or die("Bad Query: $sql"); $row = mysqli_fetch_array($result); } ?> <html> <head> <title>Fish R Us - Saltwater Fish</title> </head> <body> <div class="toptext"><center> <img src="banner.png" height="300"></img></center> </div> <center> <h2><?php echo $row['name'] ?></h2> width="150" height="150" <img src="<?php echo $row['picture'] ?>" width="150" height="150"></img> <table> <tr> <th>Name</th> <th>Type</th> <th>Quantity</th> <th>Price</th> </tr> <tr> <td><?php echo $row['name'] ?></td> <td><?php echo $row['type'] ?></td> <td><?php echo $row['qty'] ?></td> <td><?php echo $row['price'] ?></td> </tr> </table><br> <table class="fish-text"> <th><?php echo $row['description'] ?></th> </center></table><br> <button padding: 10px 24px;><a href="products.php">Return to Products List</a></button></body> <button padding: 10px 24px;><a href="menu.php">Return to Menu</a></button> </html>
Quote: $dbc = null; ... $result = mysqli_query($dbc, $sql) or die("Bad Query: $sql");
$dbc = null; ... $result = mysqli_query($dbc, $sql) or die("Bad Query: $sql");
$dbc
$conn
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)