I have uploaded multiple images and path of all the images have been stored together.
Using explode
I have separated them and now I wish to echo them in a c
Change your echo statement with :
echo "<div class='fill' style='background-image:url(http://devoirtechnologies.in/localhealthorganization/".$item.");'></div>";
and also set the width and height of this div. Because default height of the div is 0 (zero).
Try this it will help :
Use this :
<img src="<?php echo $row["offimage"]; ?>"></img>
instead of
$str= $row["offimage"];
if you want to display the image.
Code :
<?php
$con=mysqli_connect("localhost","root","","db");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$parentid = $_GET['country'];
$id = $_GET['fid'];
$sql = "SELECT * FROM register_office WHERE id='".$id."'";
$result = mysqli_query($con, $sql);
if (mysqli_num_rows($result) > 0)
{
echo "<div class='item active'>";
do
{
$str= $row["offimage"];
$array = explode('*', $str);
foreach ($array as $item)
{
echo "<div class='fill'>";
echo "<img src=\"http://example.com/abc/" . $item . "\" height=\"500\" width=\"2000\"/>";
echo "</div>";
}
} while($rs = mysqli_fetch_array($result));
echo "</div>";
}
else
{
echo "0 results";
}
?>