I created a list with two queries. A list of the first 8 photos and the other lists the last 8 photos of the table.
But the css of the second query list does not appear well.
the second query only appears when you click the "view more categories" button
the code is:
<div class="row">
<?php
$query=mysqli_query($db,"select id_album, nome, foto from albuns order by id_album ASC limit 8");
while($cat=mysqli_fetch_assoc($query)){?>
<div class="col-md-6">
<div class="portfolio-item">
<p class="imgDescription"> <?php echo $cat['nome'];?> </p>
<a>
<img class="img-portfolio img-responsive" src="<?php echo $cat['foto'];?>" onClick="location.href='listagem_album.php?id=<?php echo $cat['id_album'];?>'">
</a>
</div>
</div>
<?php } ?>
<?php
$query=mysqli_query($db,"select id_album, nome, foto from albuns order by id_album DESC limit 8");?>
<div id="fotos" style="display:none"> <?php
while($cat=mysqli_fetch_assoc($query)){?>
<div class="col-md-6">
<div class="portfolio-item">
<p class="imgDescription"> <?php echo $cat['nome'];?> </p>
<a>
<img class="img-portfolio img-responsive" src="<?php echo $cat['foto'];?>" onClick="location.href='listagem_album.php?id=<?php echo $cat['id_album'];?>'">
</a>
</div>
</div>
<?php } ?>
</div>
</div>
<!-- /.row (nested) -->
<div id="button"><a class="btn btn-dark">View More Categories</a> </div>
Related
<?php $section1 = get_field('section1'); ?>
<div class="section1" id="section1">
<div class="container">
<h2><?php echo $section1['title']; ?></h2>
<div class="quote-triangle">
<p>
<?php echo $section1['quote']; ?>
</p>
<div class="quote__moving-border"></div>
</div>
<div class="bottom">
<div data-aos="fade-down">
<div class="leftside">
<h3>
<?php echo $section1['title_image']; ?>
</h3>
<div class="caption"><?php echo $section1['caption_image']; ?></div>
<div class="desc">
<p>
<?php echo $section1['desc_image']; ?>
</p>
</div>
</div>
</div>
<div data-aos="fade-down">
<div class="rightside">
<img src="<?php echo esc_url( $secttion1['image']['url'] ); ?>" alt="" class="rightside__img">
</div>
</div>
</div>
</div>
</div>
<?php endif; ?>
I had followed literally the ACF documentation for the GROUP type but when I put the if in the PHP tag the whole section disappears and when I remove if the section back but The Group type still not worked.
Im making a website which is supposed to show records in a database including images. The texts show but the images won't. The problem lies within the tag.
<?php
while ($rows = $result->fetch_assoc()) {
?>
<div class="col-container">
<div class="row">
<div class="column">
<div class="card">
<img src="<?php echo $rows['Image'] ?>"/>
<div class="container">
<h2><?php echo $rows['PartijNaam'] ?></h2>
<p class="title"><?php echo $rows['Lijsttrekker'] ?></p>
<form action="information.php">
<p><input type="submit" class="button" href="information.php"></input></p>
</form>
</div>
</div>
</div>
</div>
<?php
}
?>
I have got a relatively simple PHP connection script to a table in my database. In this table I have a link path to my image files. I call the images using a statement like this:
$sql="SELECT * FROM table";
$result=mysql_query($sql);
and then call the image into the thumbnail with bootstrap like this:
<?php
while($rows=mysql_fetch_array($result)){
?>
<div class="container">
<div class="col-sm-8 col-md-4">
<div class="thumbnail">
<img src="<? echo $rows['image']; ?>" class="img-responsive">
<div class="caption">
<h3><? echo $rows['name']; ?></h3>
<p><? echo $rows['description']; ?></p>
<p>Open Project</p>
</div>
</div>
</div>
</div>
<?php
}
mysql_close();
?>
The pictures are correctly placed in a thumbnail, however the thumbnails are placed on a new row when it goes to the next record in the database. It should however have 3 thumbnails(3 database records) before going on to the next row.
Does anyone know how to fix this so I can have 3 thumbnails in a row?
Try to add the .row class:
<div class="container">
<div class="row">
<div class="col-sm-8 col-md-4">
...
</div>
</div>
</div>
Try this.
<div class="container">
<div class="col-sm-8 col-md-4">
<?php while($rows=mysql_fetch_array($result)){ ?>
<div class="thumbnail">
<img src="<? echo $rows['image']; ?>" class="img-responsive">
<div class="caption">
<h3><? echo $rows['name']; ?></h3>
<p>
<? echo $rows[ 'description']; ?>
</p>
<p>Open Project
</p>
</div>
<?php } mysql_close(); ?>
</div>
</div>
</div>
and add
.img-responsive{display:inline-block;}
to your css.
this should do it.
I have 10 images of each brand and want to display brand by brand with there press releases images.
Example:
Product 1:
press release_image1,press release_image2,press release_image3 so on..
Product 2:
press release_image1,press release_image2,press release_image3 so on..
Product 3:
press release_image1,press release_image2,press release_image3 so on..
<?php foreach($press as $p){ ?>
<div class="header">
<h1 class=''>
<a href="<?php echo base_url('index.php/brand/view')."/".$p->brand_id;?>">
<?php
echo $p->brand_name;
?>
</a>
</h1>
</div>
<section id="portfolio-preview-items" class="row four-cols rows_1">
<?php //$row = $this->dashboard->get_press_release($id);
?>
<!-- Portfolio Normal Mode -->
<div class="portfolio-item design web-design v3" data-id="354" style="height: 475px; margin-bottom: 20px;">
<div class="he-wrap tpl2">
<a href="<?php echo base_url('assets/files/press_release') . '/' . $p->press_image; ?>" class="image-614" data-lightbox="event_img" data-title="<?php echo $p->press_title; ?>" >
<img style="cursor:pointer;" src="<?php echo base_url('assets/files/press_release') . '/' . $p->press_image; ?>" alt="">
</a>
<div class="shape4"></div>
<div class="he-view">
<div class="bg a0" data-animate="fadeIn">
<div class="center-bar v1">
<a href="<?php echo base_url('index.php/brand/view').'/'.$p->brand_id; ?>" class="link a0" data-animate="zoomIn">
<i class="moon-link-4"></i>
</a>
</div>
</div>
</div>
</div>
</div>
<!-- Portfolio Normal Mode End -->
</section>
<?php } ?>
You can combine id and particular images(concat by ',') from mysql query.
then in php code u can use explode and implode to display each images
i have different parameters...on the products...but i want to display only those parameters that are clicked by the user.i have done this but i want to delete the duplicacy.. my code is:-
$ab=$_POST['data1'];
$karan=explode(",",$ab);
array_pop($karan);
for($i=0;$i<count($karan);$i++){
'karan['.$i.'] = '.$karan[$i];
$posts = $wpdb->get_results("SELECT * FROM demo_postmeta WHERE meta_value='".$karan[$i]."' ");
$out=array();
foreach($posts as $post){
if (!isset($out[$post->post_id])){
$out[$post->post_id][$post->meta_key]=$out;
$ram=get_the_post_thumbnail($post->post_id,"_thumbnail_id",true);
$title=get_post_meta($post->post_id,"_product_title",true);
$price=get_post_meta($post->post_id,"_product_year",true);
$link=get_post_meta($post->post_id,"_product_likes",true);
?>
<div id="itemListContent" class="in-list">
<div class="the-list">
<div class="li first row clearfix" style="cursor: pointer;">
<div class="c-1 table-cell">
<div class="cropit">
<a class="pics-lnk important-rule" href="http://uzodocs.com/PROJECTS/demo/products?post_id=<?php echo $post->post_id ?>" style="text-decoration: none;">
<?php echo $ram; ?>
</a>
</div>
</div>
<div class="second-column-container table-cell">
<h3>
<a href="http://uzodocs.com/PROJECTS/demo/products?post_id=<?php echo $post->post_id ?>" title="Kenxinda Watch Mobile Dual SIM with FREE Bluetooth Headset free home delivery - Delhi" class="important-rule" style="text-decoration: none;">
<?php echo $title; ?>
</a>
</h3>
<div class="c-4">
</div>
<span class="itemlistinginfo clearfix">
<span>
Delhi |
Cameras
- Camera Accessories
</span>
<span>
</span>
</span>
</div>
<div class="third-column-container table-cell">
<?php echo $price; ?>
</div>
<div class="fourth-column-container table-cell"><br> </div>
</div>
<div class="li even row clearfix" style="cursor: pointer;">
<div class="c-1 table-cell">
</div>
</div>
</div>
</div>
<?php
}
$out[$post->post_id][$post->meta_key][] = $post->post_id;
}
}
die;
?>
UPDATE:
This may be a way to solve your problem:
if (!in_array($post->post_id, $out)){
$out[] = $post->post_id;
You can remove the last $out[$post->post_id][$post->meta_key][] = $post->post_id;
Just put you required data into
$out[$post->post_id][$post->meta_key][] = "data you need".
and put this array out of for scope. just before die;