Alex Logorz Alex Logorz - 4 months ago 14
PHP Question

Output Unique house listings from mysql database

As in the image below, there are multiple blobs and addresses. How can I display the address only once along with its blob?

enter image description here

EXAMPLE:


BLOB

WHEATHILL WAY



BLOB

8016 PLAZA DR





<?php
error_reporting(E_ALL);

$mysqli = new mysqli("localhost","aweaea","aeaweaea!", "awewt");

if($mysqli->connect_errno) {
echo "Could not connect " . $mysqli->connect_error;
} else {
$result = $mysqli->query("SELECT * FROM images");
}
while($row = $result->fetch_assoc()) {
echo '<div id="row">' . '<div class="col1">' . '<img src="data:image/jpg; base64,' . $row['blob'] . '"/>' . '<br/>' . '<h2>' . $row['address'] . '</h2>' . '</div>' . '</div>';
}
$mysqli->close();
?>

Answer

Have a look at this.

SELECT * FROM images GROUP BY address