Html Chat limit not found , also the scroll down , - php

I got this code
if ($row['Sender'] == Admin ) {
echo '<div class="mesgs"> </div>';
echo '<div class="msg_history"> </div>';
echo '<div class="incoming_msg"> </div>';
echo '<div class="incoming_msg_img"><img src="https://ptetutorials.com/images/user-profile.png" alt="sunil"> </div>';
echo '<div class="received_msg"> </div>';
echo '<div class="received_withd_msg"> </div>';
echo "<p>" . $row["message"] . "</p>";
echo "<span class='time_date'>" . $row["dating"] . "</span>";
} else {
echo '<div class="mesgs"> </div>';
echo '<div class="msg_history"> </div>';
echo '<div class="outgoing_msg"> </div>';
echo '<div class="sent_msg"> </div>';
echo "<p>" . $row["message"] . "</p>";
echo "<span class='time_date'>" . $row["dating"] . "</span>";
It works fine , i'm supposed to get this
But i get this,
Like it's not in the chat , it gets out of the page , but i want a scroll down to check all the chat in the same size
the original code
<div class="mesgs">
<div class="msg_history">
<div class="incoming_msg">
<div class="incoming_msg_img"> <img src="https://ptetutorials.com/images/user-profile.png" alt="sunil"> </div>
<div class="received_msg">
<div class="received_withd_msg">
<p>Test which is a new approach to have all
solutions</p>
<span class="time_date"> 11:01 AM | June 9</span></div>
</div>
</div>
<div class="outgoing_msg">
<div class="sent_msg">
<p>Test which is a new approach to have all
solutions</p>
<span class="time_date"> 11:01 AM | June 9</span> </div>
</div>
<div class="incoming_msg">
<div class="incoming_msg_img"> <img src="https://ptetutorials.com/images/user-profile.png" alt="sunil"> </div>
<div class="received_msg">
<div class="received_withd_msg">
<p>Test, which is a new approach to have</p>
<span class="time_date"> 11:01 AM | Yesterday</span></div>
</div>
</div>
<div class="outgoing_msg">
<div class="sent_msg">
<p>Apollo University, Delhi, India Test</p>
<span class="time_date"> 11:01 AM | Today</span> </div>
</div>
<div class="incoming_msg">
<div class="incoming_msg_img"> <img src="https://ptetutorials.com/images/user-profile.png" alt="sunil"> </div>
<div class="received_msg">
<div class="received_withd_msg">
<p>We work directly with our designers and suppliers,
and sell direct to you, which means quality, exclusive
products, at a price anyone can afford.</p>
<span class="time_date"> 11:01 AM | Today</span></div>
</div>
</div>
</div>

Related

display 4 book details per row in image slider

I have coded this image slider that moves the image and it's details using the cursor.
I want to fetch data from database and display 4 books images with their details in each row I have tried this code but all the data have displayed in one row only.
Also if this does not take much of your time I want to make only 7 rows per page (28 books) and add numbers at the bottom of the page to move to the next 7 rows.
this is my try :
<html>
<body>
<div class="popular_causes_area section_padding">
<div class="container"> <div class="row">
<div class="col-lg-12">
<div class="causes_active owl-carousel">
<?php
try{
require('connection.php');
$sql1="select * from books ";
$rs=$db->query($sql1);
$db =null;
} catch(PDOException $ex) {
die ("Error Message ".$ex->getMessage()); }
$i=0;
while ($books = $rs->fetch()){
$i++;
$bpic = $books[2];
$btitle= $books[3];
$bq= $books[4];
$bstatus = $books[5];
$bdesc = $books[6];
$bnumber = $books[7];
$bcity = $books[8];
if ($i % 3 == 1) {
echo "<li>"; ?>
<div class="single_cause">
<div class="thumb">
<?php
if ($bpic == "" ) {
echo "<img src='img/default-image.png'
height=450px'>";
} else {
echo "<img src='img/$bpic' placeholder='nooooo'
height=450px alt=''>";
}?>
</div>
<div class="causes_content">
<div class="balance d-flex justify-content-between align-items-center">
<span>Tell:<?php echo $bnumber; ?> </span>
<span><?php echo $bcity; ?> </span>
</div>
<h4><?php echo $btitle; ?> </h4>
<p><?php echo $bdesc; echo "<br>
condation:".$bstatus; ?> </p>
</div>
</div>
</li>
<?php
} ////end of first if
if ($i % 3 == 0) {
echo "<li>"; ?>
<div class="single_cause">
<div class="thumb">
<?php
if ($bpic == "" ) {
echo "<img src='img/default-image.png' height=450px'>";
} else {
echo "<img src='img/$bpic' placeholder='nooooo' height=450px alt=''>"; ?>
</div>
<div class="causes_content">
<div class="balance d-flex justify-content-between align-items-center">
<span>Tell:<?php echo $bnumber; ?> </span>
<span><?php echo $bcity; ?> </span>
</div>
<h4><?php echo $btitle; ?> </h4>
<p><?php echo $bdesc; echo "<br>
condation:".$bstatus; ?> </p>
</div>
</div>
</li>
<?php
} //end of second if
} // end of while ?>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
This image shows what I got (all the data in one row instead of 4 books per row !):
image slider code :
<div class="popular_causes_area section_padding">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="causes_active owl-carousel">
<div class="single_cause">
<div class="thumb">
<?php
if ($bpic == "" ) {
echo "<img src='img/default-image.png' height=450px'>";
} else {
echo "<img src='img/$bpic' placeholder='nooooo' height=450px alt=''>";
}
?>
</div>
<div class="causes_content">
<div class="balance d-flex justify-content-between align-items-center">
<span>Tell:<?php echo $bnumber; ?> </span>
<span><?php echo $bcity; ?> </span>
</div>
<h4><?php echo $btitle; ?> </h4>
<p><?php echo $bdesc; echo "<br> condation:".$bstatus; ?> </p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

Column Bootstrap in while loop PHP

I have this problem
and that code is here
<div class="col-md-4 text-center animate-box">
<a href="work-single.html" class="work" style="background-image: url(images/portfolio-2.jpg);">
<div class="desc">
<h3>Project Name</h3>
<span>Brading</span>
</div>
</a>
</div>
<div class="col-md-4 text-center animate-box">
<a href="work-single.html" class="work" style="background-image: url(images/portfolio-2.jpg);">
<div class="desc">
<h3>Project Name</h3>
<span>Brading</span>
</div>
</a>
</div>
<div class="col-md-4 text-center animate-box">
<a href="work-single.html" class="work" style="background-image: url(images/portfolio-2.jpg);">
<div class="desc">
<h3>Project Name</h3>
<span>Brading</span>
</div>
</a>
</div>
now i tried to do a while loop for my php and did this code
<div class="row">
<?php
while ($userRow=$stmt2->fetch(PDO::FETCH_ASSOC))
{
echo "<div class='col-md-4 text-center animate-box'>";
echo "<a href='work-single.html' class='work' style='background-image:url(uploaded_files/uploaded_files_articles_images/" .$userRow['image']. ")';";
echo "<div class='desc'>";
echo "<h3>Project Name</h3>";
echo "<span>Illustration</span>";
echo "</div>";
echo "</a>";
echo"</div>";
}
?>
</div>
and it got me this
So what i tried so far is this
<?php
while ($userRow=$stmt2->fetch(PDO::FETCH_ASSOC))
{
<?
<div class='col-md-4 text-center animate-box'>
<?php
echo "<a href='work-single.html' class='work' style='background-image:url(uploaded_files/uploaded_files_articles_images/" .$userRow['image']. ")';";
echo "<div class='desc'>";
echo "<h3>Project Name</h3>";
echo "<span>Illustration</span>";
echo "</div>";
echo "</a>";
<?
</div>
<?php
}
?>
but still not working still the same layout . sorry for my bad english . Can someone help me to figure out what is the problem on my code. Thank you everyone in advance
echo "<a href='work-single.html' class='work' style='background-image:url(uploaded_files/uploaded_files_articles_images/" .$userRow['image']. ")';";
You are missing a > at the end.
You've missed a > in your anchor tag and also misplaced the semicolon of the CSS. Replace your code with the following one.
echo "<a href='work-single.html' class='work' style='background-image:url(uploaded_files/uploaded_files_articles_images/" .$userRow['image']. ");'>";

class row in style.php

Im working on a article:
I want 3 in one row. I know how to do it with stype, but i dont know how to do it with style.php.
enter image description here
This is only the part of code but I need to properly implement grid:
echo '<div class="container">';
echo '<div class="row padding">';
echo '<div class="col-md-4 col-sm-12">';
echo '<div class="card">';
echo '<img src="' . UPLPATH . $row['slika'] . '"';
echo '<div class="card-body">';
echo '<h6 class="card-title">';
echo '«';
echo $row['naslov'];
//style.php
<?php
header('content-type:text/css');
$grid='grid';
?>
.container {
display: <?=$grid?>;
}
Well, you are dealing the problem really improperly.
I don't really get why you need to use a variable named $grid while you can directly pass the grid attribute to your .container.
You don't have do complicate it like this.
What I would do in your case would be the next thing:
I would create a class named .grid like:
.grid {
display: grid !important;
}
As for the rest I would put it like this:
Please provide more info as regards how you extract out the $row variable data.
The layout per se, would have to be like this in order for you to have 3 cards in a row. Hope that helps you. Cheers
<div class="container grid">
<div class="row padding">
<div class="col-md-12 col-sm-12">
<div class="col-md-4 col-sm-4">
<div class="card">
<img src="<?= '"'. UPLPATH . $row['slika'] . '"' alt="whatever
you need" />
<div class="card-body">
<h6 class="card-title">
<?php echo '«' . " ". $row['naslov']; ?>
</h6>
</div>
</div>
</div>
<div class="col-md-4 col-sm-4">
<div class="card">
<img src="<?= '"'. UPLPATH . $row['slika'] . '"' alt="whatever
you need" />
<div class="card-body">
<h6 class="card-title">
<?php echo '«' . " ". $row['naslov']; ?>
</h6>
</div>
</div>
</div>
<div class="col-md-4 col-sm-4">
<div class="card">
<img src="<?= '"'. UPLPATH . $row['slika'] . '"' alt="whatever
you need" />
<div class="card-body">
<h6 class="card-title">
<?php echo '«' . " ". $row['naslov']; ?>
</h6>
</div>
</div>
</div>
</div>
</div>

How to display in 3 columns per row using cards in materialize

It displays the cards in one column instead of three at medium sizes.
I've tried the basic layout in HTML and it works fine.
echo '<div class="row>';
if($res->num_rows > 0){
while($row = $res->fetch_assoc()){
echo '<div class="col s12 m4">' .
'<div class="card">' .
'<div class="card-content">' .
'<span class="card-title">' . $row["Kanji"] . '</span>' .
$row["Onyomi"]. ' ' . $row["Kunyomi"] .
'</div>' .
'<div class="card-action">' .'<p>' . $row["English"] . '</p>' . '</div>' .
'</div>'.
'</div>';
}
}
echo '</div>';
I did it back to front.
Here is what worked.
<div class="row">
<?php if($res->num_rows > 0){
while($row = $res->fetch_assoc()){
?>
<div class="col s12 m4">
<div class="card">
<div class="card-content">
<span class="card-title"><?php echo $row["Kanji"] ?></span>
<p><?php echo $row["Onyomi"]; echo $row["Kunyomi"] ?></p>
</div>
<div class="card-action">
<?php echo $row["English"] ?>
</div>
</div>
</div>
<?php } } ?>
you can check for materialize grid https://materializecss.com/grid.html
Using materialize grid you you can put the necessary columns.
One example for 3 columns in a row
<div class="row">
<div class="col s4">Column 1</div>
<div class="col s4">Column 2</div>
<div class="col s4">Column 3</div>
</div>
you forgot quotation marks at the end of row class: class="row>

add additional echo in if statement

I have this following snippet:
<?php
if($people->num_rows >= 1) {
while($person = $people->fetch_object()) {
echo '
<div class="col-lg-4 col-md-4 col-sm-4">
<div class="card card-user">
<div class="content">
<div class="author">
<a href="'.$system->getDomain()?>/user/<?=$person->id.'">
<img class="avatar" src="'.$system->getProfilePicture($person).'">
<h4 class="title">'.$system->getFirstName($person->full_name).', '.$person->age.'</h4>
</a>
</div>
<p class="text-center text-muted">
';
echo $person->city.$system->ifComma($person->city); echo ' '.$person->country.'
</p>
</div>
</div>
</div>
';
}
} else {
?>
however next to the actual age (after the closing H4 tag) I'd like to add a further function which shows the current online status of the user.
The code for this would be as follows:
<?php if($system->isOnline($profile->last_active)) { echo '<i class="online-status online"></i>'; } else { echo '<i class="online-status offline"></i>'; } ?>
What is the best way to combine this snippet (online status) with the statement above?
Some expert help would be greatly appreciated
Separate your HTML and PHP code and do it like the below. Your requirement is done using a single line ternary operator.
<?php
if($people->num_rows >= 1) {
while($person = $people->fetch_object()) { ?>
<div class="col-lg-4 col-md-4 col-sm-4">
<div class="card card-user">
<div class="content">
<div class="author">
<a href="<?php echo $system->getDomain().'/user/'.$person->id;?>">
<img class="avatar" src="<?php echo $system->getProfilePicture($person);?>">
<h4 class="title"><?php echo $system->getFirstName($person->full_name).', '.$person->age;?></h4>
<?php echo ($system->isOnline($profile->last_active)) ? '<i class="online-status online"></i>' : '<i class="online-status offline"></i>'; ?>
</a>
</div>
<p class="text-center text-muted">
<?php echo $person->city.$system->ifComma($person->city); echo ' '.$person->country;?>
</p>
</div>
</div>
</div>
<?php
}
}
?>

Categories