How can we open different modal according by name? - php

css:
<style>
#head3{
color: #fff;
text-align: center;
font-weight: bold;
background-image: url(images/flag/sab.jpg);
background-size: 1095px 180px;
background-repeat: no-repeat;
height: 180px;
}
.flip-container {
perspective: 1000px;
}
.flip-container:hover .flipper, .flip-container.hover .flipper {
transform: rotateY(180deg);
}
.flip-container, .front, .back {
width: 240px;
height: 140px;
}
.flipper {
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}
.front, .back {
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
}
.front {
z-index: 2;
transform: rotateY(0deg);
}
.back {
background: orange;
transform: rotateY(180deg);
}
#head5{
text-align: center;
margin-top: 50px;
font-weight: bold;
color: #fff;
}
.modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.8);
z-index: 99999;
opacity:0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.modalDialog:target {
opacity:1;
pointer-events: auto;
}
.modalDialog > div {
width: 800px;
position: relative;
margin: 5% auto;
padding: 5px 20px 13px 20px;
background: #fff;
}
.close {
background: #606061;
color: #FFFFFF;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
.close:hover {
background: #00d9ff;
}
#heading{
color: #fff;
text-align: center;
font-weight: bold;
background: #260663;
width: 240px;
}
</style>
code:
<?php
$sql = "select * from country";
$result = mysqli_query($link,$sql);
while ($fetch = mysqli_fetch_array($result))
{
$id = $fetch['id'];
$about = $fetch['about'];
$country_name = $fetch['country_name'];
?>
<div class="col-md-3">
<h5 id="heading"><?php echo $fetch['country_name']; ?></h5>
<div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin-top: -15px;">
<div class="flipper">
<div class="front">
<img src="super_admin/country/flag/<?php echo $fetch['flag']; ?>" alt="USA" width="240" height="140">
</div>
<div class="back">
<h5 id="head5">About USA <span>(click)</span></h5>
</div>
</div>
</div>
<h5 id="heading">Search Colleges</h5>
</div>
<?php
}
?>
<div id="<?php echo $country_name; ?>" class="modalDialog">
<div>X
<h2><?php echo $country_name; ?></h2>
<p><?php echo $about; ?></p>
</div>
</div>
In this code I want to open diffrent modal according by country name.
<span>(click)</span>
here I am echo $country_name but there is no modal showing but when I am define openModal in place of $country_name modal open so, how can I open diffrent modal according to country_name ?
Thank You

<?php
$sql = "select * from country";
$result = mysqli_query($link,$sql);
while ($fetch = mysqli_fetch_array($result))
{
$id = $fetch['id'];
$about = $fetch['about'];
$country_name = $fetch['country_name'];
?>
<div class="col-md-3">
<h5 id="heading"><?php echo $fetch['country_name']; ?></h5>
<div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin-top: -15px;">
<div class="flipper">
<div class="front">
<img src="super_admin/country/flag/<?php echo $fetch['flag']; ?>" alt="USA" width="240" height="140">
</div>
<div class="back">
<h5 id="head5">About USA <span>(click)</span></h5>
</div>
</div>
</div>
<h5 id="heading">Search Colleges</h5>
</div>
<div id="<?php echo $country_name; ?>" class="modalDialog">
<div>X
<h2><?php echo $country_name; ?></h2>
<p><?php echo $about; ?></p>
</div>
</div>
<?php
}
?>

Related

Text overlapping even with "white-space: normal"

I'm having a problem here where the text overlaps even though the parent div has white-space: normal.
Here's my code:
div.newsfeed {
margin: 0 20%;
min-height: 5%;
background: rgba(255, 255, 255, .2);
border-radius: 10px;
padding: 2%;
border: 2px solid var(--color1);
}
div.newsfeed div.apost {
background: rgba(255, 255, 255, .1);
margin: 3% 0;
padding: 2%;
border-radius: 10px;
min-height: 197.049px;
}
div.newsfeed div.apost div.postarea {
padding: 2%;
}
div.newsfeed div.apost div.headpost {
display: flex;
align-items: center;
}
div.newsfeed div.apost div.headpost a img {
width: 40px; height: 40px;
border-radius: 50%;
float: left;
}
div.newsfeed div.apost div.headpost div.namedate {
margin-left: 1%;
}
div.newsfeed div.apost div.headpost div.namedate a p#uname {
display: block;
font-size: 18px;
color: white;
}
div.newsfeed div.apost div.headpost div.namedate a p#date {
font-size: 12px;
color: #929292;
}
div.newsfeed div.apost div.centerpost {
white-space: normal;
}
div.newsfeed div.apost div.centerpost a p {
font-size: 18px;
}
div.newsfeed div.apost div.bottompost {
display: flex;
align-items: center;
justify-content: center;
height: 55.75px;
}
div.newsfeed div.apost div.bottompost a {
margin: 0 5%;
padding: 1% 5%;
font-size: 20px;
border-radius: 5px;
}
div.newsfeed div.apost div.bottompost a:hover {
background: rgba(255, 255, 255, .1);
}
<div class="newsfeed">
<div class="apost">
<div class="headpost postarea">
<?php
$image = "../../images/pfp-placeholder.png"
?>
<a href="../profile/profile.php">
<img src="<?php echo $image ?>" alt="<?php echo $user_data['uname'] . "'s Profile" ?>" />
</a>
<div class="namedate">
<a href="../profile/profile.php">
<p id="uname">#<?php echo $USER_ROW['uname'] ?></p>
</a>
<a href="../profile/profile.php">
<p id="date">
<?php echo $ROW['date'] ?>
</p>
</a>
</div>
</div>
<label for="" class="separator"></label>
<div class="centerpost postarea">
<p class="content">
<?php echo $ROW['post'] ?>
</p>
</div>
<label for="" class="separator"></label>
<div class="bottompost postarea">
<i class="uil uil-thumbs-up"></i> Like
<i class="uil uil-comment-alt"></i> Comment
</div>
</div>
</div>
The output of this code will be:
Overlapping output
Add overflow hidden to the wrapper box

Bootstrap distorting the Border-Radius icon/image

So Im working on a project for a client and ran into an issue with Border-Radius + Bootstrap,
<div class="header">
<div class="top-nav">
<div class="container">
<div class="row">
<img class="logo" src="<?php if($custom_logo){echo $custom_logo; }else{echo $avatar;} ?>">
<nav class="social-media-top">
<h1 class="col-xs-12">Hello, I am <span><?php echo $twitch_username; ?></span></h1>
<?php if($twitch_username){ ?>
<li><i class="fa fa-twitch"></i></li>
This is after adding bootstrap to make it more responsive on mobile, well after doing that this is what the top now looks like;
This is what it looks like when I remove the Bootstrap code;
This is the code with out bootstrap on the image
<div class="header">
<div class="top-nav">
<div class="container">
<div class="row">
<img class="logo" src="<?php if($custom_logo){echo $custom_logo; }else{echo $avatar;} ?>">
<nav class="social-media-top">
<h1 class="col-xs-12">Hello, I am <span><?php echo $twitch_username; ?></span></h1>
<?php if($twitch_username){ ?>
<li><i class="fa fa-twitch"></i></li>
This is my css
/* Top Header */
.header {
padding-top: 1.5em;
border-top: solid .3em rgba(46, 204, 113, 1.0);
}
.top-nav {
margin-top: 1.2em;
margin-right: auto;
margin-bottom: .8em;
margin-left: auto;
width: 30em;
}
.logo {
float: left;
width: 5em;
height: 5em;
border: solid .1em rgba(46, 204, 113, 1.0);
border-radius: 50%;
}
.social-media-top {
float: right;
padding-bottom: 1em;
}
.social-media-top h1 {
margin: 0;
padding: 0;
color: #41eb71;
font-weight: 100;
font-size: 2em;
align-content: center;
}
.social-media-top h1 span {
color: #41eb71;
text-transform: capitalize;
font-weight: 600;
}
.social-media-top li {
display: inline-block;
}
.social-media-top li i {
display: inline-block;
width: 2em;
height: 2em;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background-color: rgba(46, 204, 113, 1.0);
color: white;
text-align: center;
line-height: 2em;
}

Why are the columns stacked up?

I am making a small shop and I have a page where I display my products. The code of this page looks like this:
<?php
error_reporting(E_ALL); ini_set('display_errors', 1);
if(isset($_GET['action']) && $_GET['action']=="add"){
$id=($_GET['id']);
if(isset($_SESSION['cart'][$id])){
$_SESSION['cart'][$id]['quantity']++;
}else{
$sql_s="SELECT * FROM products
WHERE productCode='{$id}'";
$query_s=mysql_query($sql_s) or die(mysql_error());
if(mysql_num_rows($query_s)!=0){
$row_s=mysql_fetch_array($query_s);
$_SESSION['cart'][$row_s['productCode']]=array(
"quantity" => 1,
"price" => $row_s['buyPrice']
);
}else{
$message="This product id it's invalid!";
}
}
}
?>
<h1>Classic Cars</h1>
<?php
if(isset($message)){
echo "<h2>$message</h2>";
}
?>
<div class="container">
<?php
$sql="SELECT * FROM products ORDER BY productName ASC";
$query=mysql_query($sql) or die(mysql_error());
while ($row=mysql_fetch_array($query)) {
?>
<div class="row">
<div class="col-xs-12 col-sm-4 col-md-3">
<div class="recent-work-wrap">
<img class="img-responsive" src="images/portfolio/recent/item1.png" alt="">
<div class="overlay">
<div class="recent-work-inner">
<h3><?php echo $row['productName'] ?> </h3>
<p>€<?php echo $row['buyPrice'] ?></p>
<a class="btn btn-login" href="register.php">Add to cart</i></a>
<a class="btn btn-login" href="register.php">Read more</i></a>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
Never mind the pictures, they are all the same at the moment.
The css of this part is as follows:
#recent-works .col-xs-12.col-sm-4.col-md-3{
padding: 0;
}
.recent-work-wrap {
position: relative;
}
.recent-work-wrap img{
width: 100%;
}
.recent-work-wrap .recent-work-inner{
top: 0;
background: transparent;
opacity: .8;
width: 100%;
border-radius: 0;
margin-bottom: 0;
}
.recent-work-wrap .recent-work-inner h3{
margin: 10px 0;
}
.recent-work-wrap .recent-work-inner h3 a{
font-size: 24px;
color: #fff;
}
.recent-work-wrap .overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
border-radius: 0;
background: #BDBDBD;
color: #fff;
vertical-align: middle;
-webkit-transition: opacity 500ms;
-moz-transition: opacity 500ms;
-o-transition: opacity 500ms;
transition: opacity 500ms;
padding: 30px;
}
.recent-work-wrap .overlay .preview {
bottom: 0;
display: inline-block;
height: 35px;
line-height: 35px;
border-radius: 0;
background: transparent;
text-align: center;
color: #fff;
}
.recent-work-wrap:hover .overlay {
opacity: 1;
}
The result of the code looks like this:
Why are the columns stacked up? And how can I solve this?
HTML:
<img class="img-responsive inline-block" src="images/portfolio/recent/item1.png" alt="">
Add the below markup to your CSS:
.inline-block{ display: inline-block;}
You can try this CSS property to image:
img{
display: inline-block;
float:left;
}

Menu doesn't make a block

This menu is made in html and php. I have a menu in css. Whenever I mouse over on menu item it doesn't make a link on mouseover, and whenever I click on text it make a link.
<div class="panel panel-default">
<div class="panel-heading">
<?php if($menurow['hassubmenu'] != NULL)
{?>
<a data-toggle="collapse" data-parent="#accordian" href="#<?php echo $menurow['mainmenuid']; ?>" title="<?php echo $menurow['title']; ?>"><span class="badge pull-right"><i class="fa fa-plus"></i></span><?php echo $menurow['title']; ?></a>
<?php }else{?>
<h4 class="panel-title"><?php echo $menurow['title']; ?></h4>
<?php } ?>
</div>
<?php if($menurow['hassubmenu'] != NULL){?>
<div id="<?php echo $menurow['mainmenuid']; ?>" class="panel-collapse collapse">
<div class="panel-body">
<ul>
<?php
$menuquery2 = mysql_query("select title,itemid,catid from submenu where mainmenuid=".$menurow['mainmenuid']." order by sort asc");
while($menurow2 = mysql_fetch_assoc($menuquery2))
{
if($menurow2['itemid'] != NULL)
$menulink2 = "showitem.php?id=".$menurow2['itemid'];
elseif($menurow2['catid'] != NULL)
$menulink2 = "category.php?id=".$menurow2['catid'];
else
$menulink2 = "#";
?>
<li><?php echo $menurow2['title']; ?></li>
<?php }?>
</ul>
</div>
</div>
<?php }?>
</div>
CSS Code
/* New menu */
.category-products .panel {
background-color: #FFFFFF;
border: 0px;
border-radius: 0px;
box-shadow:none;
margin-bottom: 0px;
}
.category-products .panel-default .panel-heading {
background-color: #CCCCCC;
border: 1px solid;
color: #FFFFFF;
padding: 5px 20px;
cursor:pointer;
height:40px;
}
.category-products .panel-default .panel-heading a { color: #D00233;
font-family: 'Roboto', sans-serif;
font-size: 14px;
text-decoration: none;
text-transform: uppercase;
}
.category-products .panel-default .panel-heading a:hover {background:#D00233; color:#fff;}
.category-products .panel-default .panel-heading:hover {background:#D00233; color:#fff !important;}
.category-products .panel-default .panel-heading .panel-title {
color: #D00233;
font-family: 'Roboto', sans-serif;
font-size: 14px;
text-decoration: none;
text-transform: uppercase;
}
.category-products .panel-default .panel-heading .panel-title:hover {color:#fff;background:#D00233;}
Please help me.
add this to the links and to the panel-title:
display: block;
width: 100%;
height: 100%;
in your case that would be:
.panel-title{
display: block;
width: 100%;
height: 100%;
}
.panel-title>a{
display: block;
width: 100%;
height: 100%;
}

Splitting echo row results into 3 separate columns (divs)

I have made this gallery listview page here and I want it so that all 3 columns are equally filled with items from my database, right now it creates a new column every time and displays the same sql item thrice.
Img here: http://i.stack.imgur.com/LMw1L.png
As you can see it just creates a whole bunch of columns which is not what I want.
How do I alter my php so that it neatly distributes the database items in my 3 columns (.column, .column-2, .column-3)?
home.php
<?php
ob_start();
require_once("connect.php");
if(isset($_POST['name'])){
$_SESSION["user"] = $_POST["name"];
$name = $_SESSION["user"];
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/dotbar.css">
<link rel="stylesheet" href="css/loginoverlay.css">
<!--jQuery library voor de menubar -->
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<meta charset="utf-8">
</head>
<body>
<!-- Show login screen, when cookie is not placed -->
<?php
if (empty($_COOKIE['first_time'])) {
?><div id="black-overlay">
<div id="grey-box">
<span id='close' onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode); return false;'>x</span>
<form action="home.php" method="POST">
<br>
<br>
<label for="name"> Naam: </label>
<br>
<input type="text" name="name" id="name">
<label for="password"> Wachtwoord: </label>
<br>
<input type="password" name="password" id="password">
<input type="submit" value="submit" name="submit">
</form>
</div>
</div><?php;
setcookie("first_time", 1, time()+157680000); /* expire in 5 years */}
?>
<!--page content -->
<div class="container">
<div class="container2">
<nav id='nav_bar'>
<ul class='nav_links'>
<li>
<?php
//If there is a user SESSION echo in NAV bar
if(isset($_SESSION['user'])) {
//echo admin link when admin is logged in
if ($_SESSION['user'] == 'admin') {
echo "<a href='admin.php'>Admin</a>";
echo "/<br>";
echo "<a href='sessiondestroy.php'>Log uit</a>";}
//echo user which is not the admin when logged in
else {echo $_SESSION["user"];
echo "/<br>";
echo "<a href='sessiondestroy.php'>Log uit</a>";}}
//echo the login button when user is not logged in
else { echo "<a href='login.php'>Login</a>";}
?>
<br><br><br>→<br><br><br>
</li>
<li>
<a href="?pages=home">
Home<br><br><br>→<br><br><br>
</a>
</li>
<li>
<a href="?pages=news">
Blog<br><br><br>→<br><br><br>
</a>
</li>
<li>
<a href="?pages=news2">
Gallery <br><br><br>→ <br><br><br>
</a>
</li>
<li>
<a href="?pages=news3">
About <br><br><br>→ <br><br><br>
</a>
</li>
<li>
<a href="?pages=news4">
Contact<br><br><br>→<br><br><br>
</a>
</li>
</ul>
</nav>
<div class="content">
<h1>
GRAKA!
</h1>
<div id="bar2">
<div id="circle1"></div>
<div id="circle2"></div>
<div id="circle3"></div>
<div id="circle4"></div>
<div id="circle5"></div>
<div id="circle6"></div>
<div id="circle7"></div>
<div id="circle8"></div>
<div id="circle9"></div>
<div id="circle10"></div>
<div id="circle11"></div>
</div>
<?php
if(isset($_GET['pages'])) {
$pages = $_GET['pages'];
$pagename = $pages. '.php';
include_once($pagename);
}?>
</div>
</div>
</div>
<footer>
<div class="footer-content">
<h2>
Designed and produced by
</h2>
<h3>
All rights reserved.<br>
</h3>
</div>
</footer>
<!--Menubar script -->
<script src="menubar.js"></script>
</body>
</html>
<?php
ob_flush();
?>
news2.php
$query = "SELECT * FROM gallery";
$result = mysqli_query($con, $query);
$count = 0;
while ($row = mysqli_fetch_array($result)) {?>
<?php if($count % 3 == 0) {?>
<div class="column">
<div style="width: 100%; height: 0; padding-bottom: 100%; background-image:url('img/<?php
echo "".$row['galleryfoto']."";
?>'); background-repeat:no-repeat; background-size:cover; background-color: black; float:left; background-position: center;"></div>
<h4><?php echo $row['gallerytitel']?></h4>
</div>
<?php}?>
<div class="column2">
<div style="width: 100%; height: 0; padding-bottom: 100%; background-image:url('img/<?php
echo "".$row['galleryfoto']."";
?>'); background-repeat:no-repeat; background-size:cover; background-color: black; float:left; background-position: center;"></div>
<h4><?php echo $row['gallerytitel']?></h4>
</div>
<div class="column3">
<div style="width: 100%; height: 0; padding-bottom: 100%; background-image:url('img/<?php
echo "".$row['galleryfoto']."";
?>'); background-repeat:no-repeat; background-size:cover; background-color: black; float:left; background-position: center;"></div>
<h4><?php echo $row['gallerytitel']?></h4>
</div>
<?php } ?>
css:
body {
margin: 0px;
padding: 0px;
background-color: black;
background-attachment: fixed;
background-image: url(img/2560x2560bubbles.png);
background-size: cover;
font-family: "Segoe UI", 'Helvetica Neue';
}
.container {
margin-top: 520px;
box-shadow: 10px 10px 5px #888888;
-webkit-box-shadow: 0px 0px 30px 0px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 0px 30px 0px rgba(50, 50, 50, 0.75);
box-shadow: 0px 0px 30px 0px rgba(50, 50, 50, 0.75);
background-image: -moz-linear-gradient( 180deg, rgb(158, 158, 158) 0%, rgb(188, 188, 188) 10%, rgb(220, 220, 220) 22%, rgb(251, 251, 251) 50%, rgb(220, 220, 220) 78%, rgb(188, 188, 188) 90%, rgb(158, 158, 158) 100%);
background-image: -webkit-linear-gradient( 180deg, rgb(158, 158, 158) 0%, rgb(188, 188, 188) 10%, rgb(220, 220, 220) 22%, rgb(251, 251, 251) 50%, rgb(220, 220, 220) 78%, rgb(188, 188, 188) 90%, rgb(158, 158, 158) 100%);
background-image: -ms-linear-gradient( 180deg, rgb(158, 158, 158) 0%, rgb(188, 188, 188) 10%, rgb(220, 220, 220) 22%, rgb(251, 251, 251) 50%, rgb(220, 220, 220) 78%, rgb(188, 188, 188) 90%, rgb(158, 158, 158) 100%);
}
.container2 {
width: 1280px;
padding-bottom: 100px;
margin-left: auto;
margin-right: auto;
overflow: hidden;
}
nav {
margin-left: 7.5%;
margin-top: 100px;
width: 10%;
float: left;
}
#nav_bar {}
.navbar-fixed {
top: 0;
z-index: 100;
position: fixed;
margin-left: 5.3%;
}
ul {
list-style-type: none;
}
li {
float: left;
font-size: 1em;
width: 100%;
height: auto;
text-align: left;
font-weight: bold;
line-height: 1em;
margin-left: 0%;
margin-top: 0px;
clear: none;
min-height: 0px;
}
a {
text-decoration: none;
color: black;
}
a:visited {
text-decoration: none;
color: black;
}
a:hover {
text-decoration: none;
color: grey;
}
a:focus {
text-decoration: none;
color: yellowgreen;
}
a:active {
text-decoration: none;
color: greenyellow
}
.content {
width: 70%;
margin-right: 7.5%;
margin-top: 100px;
float: right;
}
article {
width: 45.4%;
padding: 2.3%;
float: left;
}
img {
width: 100%;
}
h1 {
text-align: right;
margin: 0px;
font-size: 6.0em;
margin-bottom: 10px;
}
h2 {
margin: 0px;
text-align: center;
}
h3 {
margin: 0px;
text-align: center;
}
p {}
p1 {
float: right;
}
footer {
margin-top: 320px;
background-color: rgb(28, 28, 28);
height: 260px;
padding: 120px;
}
.footer-content {
color: white;
}
/*--Bloglist.css --*/
#blog {
width: 100%;
padding: 2.3%;
margin-top: 2.3%;
overflow: hidden;
}
article3 {
width: 100%;
padding: 2.3%;
overflow: hidden;
}
#blogfoto {
width: 257px;
height: 257px;
float: left;
overflow: hidden;
background-color: black;
}
p1#blog {
margin-top: 0px;
width: 62.07%;
float: left;
}
h4 {
margin-left: 2.3%;
float: left;
width: 56.66%;
margin-bottom: 0px;
}
/*-- Thumbnails --*/
.wrapper {
width: 400px;
height: 200px;
overflow: hidden;
background-size: cover;
}
/*-- Gallerylist -- */
.column {
float: left;
margin-left: 0px;
margin-top: 20px;
width: 28.73%;
padding: 2.3%;
background-color: blue;
}
.column2 {
float: left;
margin-left: 0px;
margin-top: 20px;
width: 28.73%;
padding: 2.3%;
background-color: green;
}
.column3 {
float: left;
margin-left: 0px;
margin-top: 20px;
width: 28.73%;
padding: 2.3%;
background-color: red;
}
I'm assuming that you want each column to show a different row from your database. If so, just include a counter variable say $count = 0; before you enter your loop.
When $count % 3 == 0 use the class '.column', when $count % 3 == 1 use the '.column-2' and $count % 3 == 2 use '.column-3'.
Don't forget to increment the loop counter at the end of each iteration.
Edit:
<?php
$query = "SELECT * FROM gallery";
$result = mysqli_query($con, $query);
$count = 0;
while ($row = mysqli_fetch_array($result)) {?>
<?php if($count % 3 == 0) {?>
<div class="column">
<div style="width: 100%; height: 0; padding-bottom: 100%; background-image:url('img/<?php
echo "".$row['galleryfoto']."";
?>'); background-repeat:no-repeat; background-size:cover; background-color: black; float:left; background-position: center;"></div>
<h4><?php echo $row['gallerytitel']?></h4>
<?php }
else if($count % 3 == 1){
?>
</div>
<div class="column2">
<div style="width: 100%; height: 0; padding-bottom: 100%; background-image:url('img/<?php
echo "".$row['galleryfoto']."";
?>'); background-repeat:no-repeat; background-size:cover; background-color: black; float:left; background-position: center;"></div>
<h4><?php echo $row['gallerytitel']?></h4>
</div>
<?php }
else{
?>
<div class="column3">
<div style="width: 100%; height: 0; padding-bottom: 100%; background-image:url('img/<?php
echo "".$row['galleryfoto']."";
?>'); background-repeat:no-repeat; background-size:cover; background-color: black; float:left; background-position: center;"></div>
<h4><?php echo $row['gallerytitel']?></h4>
</div>
<?php
}
$count++;
}
?>
This is not the neatest code, but this should get the job done.

Categories