Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "localhost";
- $user = "root";
- $password = "";
- $dbname = "henry";
- $con=mysqli_connect($host, $user, $password, $dbname);
- if (mysqli_connect_errno()) {
- echo "Failed to connect to MariaDB: " . mysqli_connect_error();
- exit;
- }
- $query = "SELECT CONCAT(T1.Title, ' - ', T2.Title) AS Titles
- FROM book T1 JOIN book T2 ON T1.Price = T2.Price
- AND T1.Title > T2.Title
- AND T1.PublisherCode = T2.PublisherCode";
- $result = mysqli_query($con, $query);
- if (!$result) {
- print ( "Could not successfully run query ($querystring) from DB: " . mysqli_error($con));
- exit;
- }
- if (mysqli_num_rows($result) == 0) {
- print ("No branch found for branch number: $branchNum");
- exit;
- }
- while($row = mysqli_fetch_array($result)){
- print($row['Titles']);
- echo '<br/>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement