codeigniter query duplicate data displaying - mysql

I am getting comments from a database, I have a row with two columns, I am looping through the database table which contains two results, for some reason the data that is retrieve from the database is being duplicated.
comments view
<?php foreach ($query->result_array() as $row) { ?>
<div class="row ">
<div class="large-6 columns">
<div class="callout large ">
<p class=""><?php echo $row['comment'];?></p>
</div>
</div>
<div class="large-6 columns">
<div class="callout large bluebg ">
<p class="white"><?php echo $row['comment'];?></p>
</div>
</div>
</div>
<?php } ?>
query
function get_testimonies() {
$query = $this->db->query('SELECT comment FROM testimonies');
return $query;
}
current result
comment 1 comment 1
comment 2 comment 2
expected result
comment 1 comment 2

You have an echo two times, try something like:
<?php foreach ($query->result_array() as $row)
{
?>
<div class="row ">
<div class="large-6 columns">
<div class="callout large ">
<p class=""><?php echo $row['comment'];?></p>
</div>
</div>
</div>
<?php
}
?>

Related

Photos on website only showing in one row, I need to add multiple rows

Why is my code displaying multiple rows instead of 1?
I can upload any number of photos to my site, but it only displays 4 photos across, the 4 most recently uploaded, on the website. I want it to display 4 rows of photos, instead of 1 row.
<div class="profile_box_body">
<?php
if(!empty($RecentPhotos)){
?>
<div class="profile_photos_list row">
<?php
foreach($RecentPhotos as $value){ ?>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 media_item block-center">
<div class="profile_photo ">
<!--<a href="javascript:void();" class="clickable" data-toggle="modal" data-target="#myModal">-->
<a href="<?=WATERMARK_FILE!=''?DisplayImageWithWatermark($value):DB_DOMAIN.'uploads/images/'. $value['bigimage']; ?>" data-fancybox="gallery<?php echo $value["aid"] ?>" >
<div class="img-container-large">
<div class="img-responsive-container img-responsive-container--border">
<img src="<?=$value['image']; ?>" class="pImageBorder img-responsive-container__img">
</div>
</div>
<div class="pImageUsername"><b><?=$value['title']; ?></b><br/><?=$value['description']; ?></div>
</a>
</div>
</div>
<?php
}
?>
</div>
<?php
}
else {
?>
<a class="" style="float: none; text-align: center" href='<?=getThePermalink('account/&dll=gallery')?>'><p> <?=$lang_register_page['a14'] ?></p></a>
<?php
}
?>
</div>
This is not a problem with your HTML or CSS. The problem is into your PHP query. You should check first that, is there a limit = 1 called into your query?

Bootstrap Woocommerce checkout columns not aligned

I've been trying to align my checkout columns side by side for hours and finally decided to swallow my pride and ask for help, I can imagine it's something pretty simple but I can not find it,
When I visit here, and add anything to cart to see the problem, the columns are not aligned side to side, just underneath each other.
Running with Bootstrap + WordPress + Woocommerce.
SCREENSHOT
https://ibb.co/bK382Z8
CODE:
<div class="">
<form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data">
<?php if ( $checkout->get_checkout_fields() ) : ?>
<?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>
<div class="row" id="customer_details">
<div class="col-xs-12 col-md-6">
<div class="checkbox-form">
<?php do_action( 'woocommerce_checkout_billing' ); ?>
<?php do_action( 'woocommerce_checkout_shipping' ); ?>
</div>
</div>
<div class="col-xs-12 col-md-6">
<?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
<h3 id="order_review_heading"><?php _e( 'Your order', '99fy' ); ?></h3>
<?php do_action( 'woocommerce_checkout_before_order_review' ); ?>
<div id="order_review" class="woocommerce-checkout-review-order">
<?php do_action( 'woocommerce_checkout_order_review' ); ?>
</div>
<?php do_action( 'woocommerce_checkout_after_order_review' ); ?>
</div>
</div>
<?php endif; ?>
</form>
The second column that is going under is not in the row, you can see this in HTML. Add the second column inside the row and it should work.
It's roughly supposed to look like this:
<div class="row" id="customer_details">
<div class="col-xs-12 col-md-6">
<div class="checkbox-form">...</div>
</div>
<div class="col-xs-12 col-md-6">
<h3 id="order_review_heading">Your order</h3>
<div id="order_review" class="woocommerce-checkout-review-order">...</div>
</div>
</div>

Mysql data not arranged in perfect row

Thanks for previous helps. Am here with another one.
Ok, so i am retrieving data from database.. its working fine, but where i have issues is that after the data spans the first row it doesn't start from the first column of the next row.. I don't know how to explain this better ... but I'I'll add the code and image here....
<div class="row">
<?php
$selectCat = "SELECT * FROM categories ORDER BY cat_id DESC";
$selectCatKwary = mysqli_query($link, $selectCat);
$catCount = mysqli_num_rows($selectCatKwary);
if ($catCount > 0) {
?>
<?php
while ( $catRow = mysqli_fetch_array($selectCatKwary)) { ?>
<a href="">
<div class="col-lg-3 col-sm-6">
<div class="card">
<div class="content">
<div class="row">
<div class="col-xs-5">
<div class="icon-big icon-warning text-center">
<i class="ti-user"></i>
</div>
</div>
<div class="col-xs-7">
<div class="numbers">
<p class="text-uppercase text-bold"><?php echo $catRow['catTitle']; ?></p>
105GB
</div>
</div>
</div>
</div>
</div>
</div>
</a>
<?php } } ?>
</div>
and here is the image
The first four data resolved well... the next one which MOBILE CARS did not start from the beginning column, and also affected others

Creating columns in bootstrap

EDIT: I realized I was putting dots in front of classes. Please stop downvoting.
I'm trying to create columns in my search results. I want the results to appear in columns of 3.
This is my code:
<div class=".container">
<div class=".row">
<div class=".col-xs-3">
<h2><?php the_title(); ?></h2>
<?php
if ( has_post_thumbnail() ) {
echo '<p>';
the_post_thumbnail("small");
echo '</p>';
}
?>
<p><br /><?php the_excerpt(); ?><p>
</div>
</div>
</div>
Nothing happening.
Classes found at: http://tomasjanecek.cz/en/clanky/post/list-of-bootstrap-3-css-classes-with-description
CSS class selectors begin with a . character.
HTML class names do not (well, they can, but it is more trouble than it is worth and the Bootstrap CSS doesn't expect them to).
<div class="container">
<div class="row">
<div class="col-xs-3">
Don't use . character inside HTML tags classes
Try this code:
<div class="container">
<div class="row">
<div class="col-xs-3">
<h2><?php the_title(); ?></h2>
<?php
if ( has_post_thumbnail() ) {
echo '<p>';
the_post_thumbnail("small");
echo '</p>';
}
?>
<p><br /><?php the_excerpt(); ?><p>
</div>
</div>

Bootstrap CSS Calendar align months

I really hope there is an easy fix for this. Basically on full screen I want two months to show in a colum, on smaller devices it shifts to 1 column (i am using .col-md-6 for this), with 3 rows total showing 6 months. This works if each div is the same size. The issue arrises when there is a month with less "blocks of days"
see here: https://www.dropbox.com/s/1rrryqzzppql858/months.png?dl=0
is there some sort of vertical-align css that can be used in bootstrap to fix this???
Here is my code:
<?php
$date = date_create("2015-01-01");
$date_end = date_create("2015-07-01");
while ($date < $date_end):?>
<div class="col-md-6 month_border">
<?php echo "<h2>".date_format($date,'F')."<small>".date_format($date,'Y')."</small></h2>"; ?>
<div class="row">
<?php
//date_format($date,'w') Day of week: 0 = Sunday
//date_format($date,'t') Number of days in current month
$weekday = date_format($date,'w');
$total_days = date_format($date,'t');
$days28 = 0;
if ($total_days == 28) {$days28 = 1;}
for ($day_block = 0 - $weekday + 1; $day_block <= $total_days + $days28; $day_block ++):?>
<?php if($day_block > 0 AND $day_block <= $total_days):?>
<div class="col-7split day_block" id="day_block-<?php echo date_format($date,'n')."-".$day_block; ?> "
data-toggle="modal" data-target="#myModal" data-whatever="#mdo">
<div class="row border bg-info">
<?php echo $day_block; ?>
</div>
<div class="row border">
<div class="col-sm-6 shift_text">
<?php if($day_block != 3) { echo "N"; } ?>
</div>
<div class="col-sm-6 compliment_text nopadding hidden-print">
</div>
</div>
<?php else:?>
<div class="col-7split day_block">
<?php endif; ?>
</div>
<?php endfor; ?>
</div>
</div>
<?php date_modify($date,"+1 months"); endwhile; ?>