Add Another Card to the Right PHP SQL - php

How can i add another user to its right, when i limit it to 5 it goes down not to the right im pretty stuck here how can i align it, i dont know the term or what you call that thing thanks in advance
<h2>Recently Added</h2>
<?php
include_once('connection.php');
$sql = "SELECT * FROM tblstdpro
ORDER BY StdID DESC LIMIT 0, 5";
$result = mysqli_query($conn,$sql);
$count = 0;
while($row = mysqli_fetch_array($result)){
$StudentID="<a href='ProfileRecords.php?id=".$row['StdID']."'>".$row['StdID']."</a>";
$StdName="<a href='ProfileRecords.php?id=".$row['StdID']."'>" . $row['Fname'] . ' ' . $row['Lname'] . "</a>";
?>
<div class="col-md-6">
<!-- USERS LIST -->
<div class="box box-danger">
<div class="box-header with-border">
<h3 class="box-title">Latest Members</h3>
<div class="box-tools pull-right">
<span class="label label-danger"> New Members</span>
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
<button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
</div>
</div><!-- /.box-header -->
<div class="box-body no-padding">
<ul class="users-list clearfix">
<li>
<img src="<?php echo $row['StdImage'];?>" alt="User Image">
<a class="users-list-name" href="#"><?php echo "$StdName" ?></a>
<span class="users-list-date"><?php echo "$StudentID" ?></span>
<?php } ?>
<div class="box-footer text-center">
View All Users
</div><!-- /.box-footer -->
</div><!--/.box -->
</div><!-- /.col -->
</div><!-- /.row -->

Related

dynamic tab using php

Hi everyone I'm niubbie in php.I have a problem with tab. I would like the tabs on their click to show a different topic. All this using php and calling the db.
My DB:
giorno
pranzo
cena
lunedi
12:00
20:00
martedi
12:00
20:00
mercoledi
12:00
20:00
giovedi
12:00
20:00
venerdi
12:00
20:00
Days are represented by tabs and when I click on a different day I want it to show lunch and dinner of that particular day.
My code:
<section class="big-section bg-light-gray border-top border-color-medium-gray wow animate__fadeIn">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12 text-center margin-six-bottom">
<h6 class="alt-font text-extra-dark-gray font-weight-500">Orari</h6>
</div>
</div>
<div class="row justify-content-center">
<div class="col-12 col-lg-10 tab-style-05">
<div class="tab-box">
<!-- start tab navigation -->
<ul class="nav nav-tabs margin-7-rem-bottom md-margin-5-rem-bottom xs-margin-15px-lr align-items-center justify-content-center font-weight-500 text-uppercase">
<?php
$sql = "SELECT * FROM orari_ristorante ";
$risultato = mysql_query($sql) or die(mysql_error()."<br>Impossibile eseguire l'interrogazione");
$i=0;
while ($riga = mysql_fetch_assoc($risultato)){
?>
<?php if($i == 0){?>
<li class="nav-item alt-font"><a class="nav-link active" href="#tab-nine1" data-toggle="tab"><?php echo $riga['giorno'];?></a></li>
<?php }else{?>
<li class="nav-item alt-font"><a class="nav-link" href="#tab-nine1" data-toggle="tab"><?php echo $riga['giorno'];?></a></li>
<?php }
$i++;
}?>
</ul>
<!-- end tab navigation -->
</div>
<div class="tab-content">
<!-- start tab content -->
<div class="tab-pane med-text fade in active show" id="tab-nine1">
<div class="panel-group accordion-event accordion-style-04" id="accordion1" data-active-icon="icon-feather-minus" data-inactive-icon="icon-feather-plus">
<!-- start accordion item -->
<div class="panel border-color-black-transparent">
<div class="panel-heading">
<?php
$sql = "SELECT pranzo,cena FROM orari_ristorante LIMIT 1";
$risultato = mysql_query($sql) or die(mysql_error()."<br>Impossibile eseguire l'interrogazione");
while ($riga = mysql_fetch_assoc($risultato)){
?>
<span class="panel-time">Pranzo</span>
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1">
<div class="panel-title">
<span class="text-extra-dark-gray d-inline-block font-weight-500"><?php echo $riga['pranzo'] ;?></span>
</div>
</a>
<span class='prenota'>PRENOTA</span>
<span class="panel-time">Cena</span>
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1">
<div class="panel-title">
<span class="text-extra-dark-gray d-inline-block font-weight-500"><?php echo $riga['cena'] ;?></span>
</div>
</a>
<span class='prenota'>PRENOTA</span>
<?php
}
?>
</div>
</div>
</div>
</div>
<!-- end tab content -->
</div>
</div>
</div>
</div>
</section>
My problem is that each tab shows all the rows and not the specific one for that day
My Problem
You need to ensure you are using unique ID's for your contents and using them in your href of the tab.
Reading your code it looks like each tab is created with the same ID
<li class="nav-item alt-font"><a class="nav-link active" href="#tab-nine1" data-toggle="tab"><?php echo $riga['giorno'];?></a></li>
I would echo out the unique id from the database eg.
href="#tab-<?echo $riga['id'];?>" (or whatever your unique column header is)
Ensure you also echo this out further down when the tab content is being created.
Based on what you are trying to accomplish, if you limit your results to one, you will always only show the first day in the db. Here's how I would change your second while loop.
<?php
$sql = "SELECT * FROM orari_ristorante";
$risultato = mysqli_query($conn, $sql);
$i = 0;
while ($riga = mysqli_fetch_assoc($risultato)){
if($i == 0){
$css = ""
}else{
$css = "display:none"
}
?>
<div class="giorno_tab <?php echo $riga['giorno'] ;?>" style="<?php echo $css ;?>">;
<span class="panel-time">Pranzo</span>
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1">
<div class="panel-title">
<span class="text-extra-dark-gray d-inline-block font-weight-500"><?php echo $riga['pranzo'] ;?></span>
</div>
</a>
<span class='prenota'>PRENOTA</span>
<span class="panel-time">Cena</span>
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1">
<div class="panel-title">
<span class="text-extra-dark-gray d-inline-block font-weight-500"><?php echo $riga['cena'] ;?></span>
</div>
</a>
<span class='prenota'>PRENOTA</span>
</div>
<?php
$i++;}
?>
</div>
It is not the solution, however you can build on top of that to accomplish what you are trying to do. Hopefully that somewhat helps.
Just to explain, I was adding $riga["giorno"] as an kind of ID in the class, however Revbo's answer would give a clearer code when it comes to an ID

small boxes go out line of container

enter image description here
I'm trying to make a dashboard
When placing small boxes in the board
The boxes that are in the new row go outside the bounds of the page
The boxes in the first row appear correctly, but the problem starts when they go down to the second and third row, and so on.....
How can I solve this problem please?`
<!-- Small boxes (Stat box) -->
<div class="row">
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-hc">
<div class="inner text-hc">
<?php
$stmt = $conn->prepare("SELECT * FROM ticket_prices ");
$stmt->execute();
$total = 0;
foreach ($stmt as $srow) {
$subtotal = $srow['TicketPrice'];
$total += $subtotal;
}
echo "<h3>" . $total, 2 . " AED</h3>";
?>
<p>Total Sales from products</p>
</div>
<div class="icon">
<i class="fa fa-shopping-cart"></i>
</div>
<a href="../booking/index.php" class="small-box-footer">More info <i
class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<!-- ./col -->
<!-- Small boxes (Stat box) -->
<div class="row">
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-hc">
<div class="inner text-hc">
<?php
$stmt = $conn->prepare("SELECT * FROM ticket_prices ");
$stmt->execute();
$total = 0;
foreach ($stmt as $srow) {
$subtotal = $srow['TicketPrice'];
$total += $subtotal;
}
echo "<h3>" . $total, 2 . " AED</h3>";
?>
<p>Total Sales from products</p>
</div>
<div class="icon">
<i class="fa fa-shopping-cart"></i>
</div>
<a href="../booking/index.php" class="small-box-footer">More info <i
class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<!-- ./col -->
<!-- Small boxes (Stat box) -->
<div class="row">
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-hc">
<div class="inner text-hc">
<?php
$stmt = $conn->prepare("SELECT * FROM ticket_prices ");
$stmt->execute();
$total = 0;
foreach ($stmt as $srow) {
$subtotal = $srow['TicketPrice'];
$total += $subtotal;
}
echo "<h3>" . $total, 2 . " AED</h3>";
?>
<p>Total Sales from products</p>
</div>
<div class="icon">
<i class="fa fa-shopping-cart"></i>
</div>
<a href="../booking/index.php" class="small-box-footer">More info <i
class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<!-- ./col -->
<!-- Small boxes (Stat box) -->
<div class="row">
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-hc">
<div class="inner text-hc">
<?php
$stmt = $conn->prepare("SELECT * FROM ticket_prices ");
$stmt->execute();
$total = 0;
foreach ($stmt as $srow) {
$subtotal = $srow['TicketPrice'];
$total += $subtotal;
}
echo "<h3>" . $total, 2 . " AED</h3>";
?>
<p>Total Sales from products</p>
</div>
<div class="icon">
<i class="fa fa-shopping-cart"></i>
</div>
<a href="../booking/index.php" class="small-box-footer">More info <i
class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<!-- ./col -->
<!-- Small boxes (Stat box) -->
<div class="row">
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-hc">
<div class="inner text-hc">
<?php
$stmt = $conn->prepare("SELECT * FROM ticket_prices ");
$stmt->execute();
$total = 0;
foreach ($stmt as $srow) {
$subtotal = $srow['TicketPrice'];
$total += $subtotal;
}
echo "<h3>" . $total, 2 . " AED</h3>";
?>
<p>Total Sales from products</p>
</div>
<div class="icon">
<i class="fa fa-shopping-cart"></i>
</div>
<a href="../booking/index.php" class="small-box-footer">More info <i
class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<!-- ./col -->
</section>`
Your HTML structure is wrong. You can see it clearly in sublime or vs code or any of the html editor.
Assuming that you are going to Loop either the 'Box' or the 'Row of 4 Boxes', I have re-structured the HTML without the "PHP" code.
Looping Option 1 :
Look for <!-- Looping Option 1 -->, You can loop the boxes from here.
Looping Option 2 :
Look for <!-- Looping Option 2 -->, You can loop the row of 4 boxes from here.
<section>
<div class="container">
<!-- Lopping option 2 -->
<div class="row">
<!-- Lopping option 1 -->
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-hc">
<div class="inner text-hc">
<h3></h3>
<p>Total Sales from products</p>
</div>
<div class="icon">
<i class="fa fa-shopping-cart"></i>
</div>
<a href="../booking/index.php" class="small-box-footer">More info <i
class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<!-- Lopping option 1 -->
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-hc">
<div class="inner text-hc">
<h3></h3>
<p>Total Sales from products</p>
</div>
<div class="icon">
<i class="fa fa-shopping-cart"></i>
</div>
<a href="../booking/index.php" class="small-box-footer">More info <i
class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-hc">
<div class="inner text-hc">
<h3></h3>
<p>Total Sales from products</p>
</div>
<div class="icon">
<i class="fa fa-shopping-cart"></i>
</div>
<a href="../booking/index.php" class="small-box-footer">More info <i
class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-hc">
<div class="inner text-hc">
<h3></h3>
<p>Total Sales from products</p>
</div>
<div class="icon">
<i class="fa fa-shopping-cart"></i>
</div>
<a href="../booking/index.php" class="small-box-footer">More info <i
class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
</div>
<!-- Lopping option 2 -->
</div>
</section>

Display Count of DB Records in PHP Dashboard

I need to display a "count" of records (rows) in my SQLtable "doctors". This count must appear on my dashboard page in the below element for total number of doctors
This is index.php for my dashboard page
<?php
$con = mysqli_connect("localhost","root","","hospital_db");
$result = mysqli_query($con,"SELECT * FROM doctors");
$rows = mysqli_num_rows($result);
$content = '<div class="row">
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner">
<h3><?php echo '.$rows.';?></h3>
<p>Doctors</p>
</div>
<div class="icon">
<i class="ion ion-bag"></i>
</div>
View Doctors <i class="fa fa-arrow-circle-right"></i>
</div>
</div>
<!-- ./col -->
</div>';
include('../master.php');
?>
You should use mysqli object in new php version try the following code
Make connection first like
<?php
$con = mysqli_connect("localhost","my_user","my_password","my_db");
$result = mysqli_query($con,"SELECT * FROM doctors");
$rows = mysqli_num_rows($result);
echo "There are " . $rows . " rows in my table.";
$content = '<div class="row">
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner">
*<h3><?php echo "$rows"; } ?></h3>*
<p>Doctors</p>
</div>
<div class="icon">
<i class="ion ion-bag"></i>
</div>
View Doctors <i class="fa fa-arrow-circle-right"></i>
</div>
</div>
<!-- ./col -->
</div>';
include('../master.php');
?>
if you just need the count then why don't you use the aggregate function count(*) in your query. this much better helps you. and in your code in h3 tag you can concat the string directly rather than using again php code. this might looks better and in structured form.
try this:
<?php
$con = mysqli_connect("localhost","my_user","my_password","my_db");
$result = mysqli_query($con,"SELECT count(*) as total_rows FROM doctors");
$rows = $result->total_rows;
echo "There are " . $rows . " rows in my table.";
$content = '<div class="row">
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner">
*<h3>'.$rows.'</h3>*
<p>Doctors</p>
</div>
<div class="icon">
<i class="ion ion-bag"></i>
</div>
View Doctors <i class="fa fa-arrow-circle-right"></i>
</div>
</div>
<!-- ./col -->
</div>';
include('../master.php');
?>

Printing out results inside 2 whiles

So im building a fast food website i have built most of it apart from displaying the menu this will be different for each take away which is signed up. I have worked out that im gonna have categories and items so the take away can have a categories called "trays" then 5 items inside that categories with all the different trays they do then they can make another categorie for another block of food and so on. Problem i have is i will need to print out the categories and the items. I have 1 table called categories then another called topics the items will be stored in the topic table and categories in categories so would need to display it like so
categorie
topic
topic
topic
over and over.
Here is my html
<div class="menu-widget" id="2">
<div class="widget-heading">
<h3 class="widget-title text-dark">
POPULAR ORDERS Delicious hot food!
<a class="btn btn-link pull-right" data-toggle="collapse" href="#popular2" aria-expanded="true">
<i class="fa fa-angle-right pull-right"></i>
<i class="fa fa-angle-down pull-right"></i>
</a>
</h3>
<div class="clearfix"></div>
</div>
<div class="collapse in" id="popular2">
<div class="food-item">
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-8">
<div class="rest-logo pull-left">
<a class="restaurant-logo pull-left" href="#"><img src="http://placehold.it/100x80" alt="Food logo"></a>
</div>
<!-- end:Logo -->
<?php echo "food inside";?>
<div class="rest-descr">
<h6>Veg Extravaganza</h6>
<p> Burgers, American, Sandwiches, Fast Food, BBQ</p>
</div>
<!-- end:Description -->
</div>
<!-- end:col -->
<div class="col-xs-12 col-sm-12 col-lg-4 pull-right item-cart-info"> <span class="price pull-left">$ 19.99</span> + </div>
</div>
<!-- end:row -->
</div>
<!-- end:Food item --><!-- end:Food item --><!-- end:Food item -->
<div class="food-item white"><!-- end:row -->
</div>
<!-- end:Food item -->
</div>
<!-- end:Collapse -->
</div>
<!-- end:Widget menu -->
and here is my code
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-6"><!-- end:Widget menu -->
<?php
///first select the category based on $_GET['cat_id']
$sql = "SELECT * FROM categories WHERE takeawayid =' ".$id1."'";
$result = mysql_query($sql);
if(!$result)
{
echo 'The category could not be displayed, please try again later.' . mysql_error();
}
else
{
if(mysql_num_rows($result) == 0)
{
echo 'This category does not exist.';
}
else
{
//display category data
while($row = mysql_fetch_assoc($result))
{
?>
<div class="menu-widget" id="2">
<div class="widget-heading">
<h3 class="widget-title text-dark">
<?php echo $row['cat_name'] ; ?> <a class="btn btn-link pull-right" data-toggle="collapse" href="#popular2" aria-expanded="true">
<i class="fa fa-angle-right pull-right"></i>
<i class="fa fa-angle-down pull-right"></i>
</a>
</h3>
<div class="clearfix"></div>
<?php
//do a query for the topics
$sql2 = "SELECT * FROM topics WHERE topic_cat =' ".$row['cat_id']."'";
$result2 = mysql_query($sql2);
}
echo $row2['topic_subject'] ;
if(!$result2)
{
echo 'The topics could not be displayed, please try again later.';
}
else
{
if(mysql_num_rows($result2) == 0)
{
echo 'There are no topics in this category yet.';
}
else
{
//prepare the table
while($row2 = mysql_fetch_assoc($result2))
{
?>
<div class="collapse in" id="popular2">
<div class="food-item">
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-8">
<div class="rest-logo pull-left">
<a class="restaurant-logo pull-left" href="#"><img src="http://sdfsdf.com/beta/restaurants/<?php echo $id33 ;?>.png" alt="Food logo"></a>
</div>
<!-- end:Logo -->
<div class="rest-descr">
<h6><?php echo $row2['topic_subject'] ;?></h6>
<p> Burgers, American, Sandwiches, Fast Food, BBQ</p>
</div>
<!-- end:Description -->
</div>
<!-- end:col -->
<div class="col-xs-12 col-sm-12 col-lg-4 pull-right item-cart-info"> <span class="price pull-left">$ 19.99</span> + </div>
</div>
<!-- end:row -->
</div>
<!-- end:Food item --><!-- end:Food item --><!-- end:Food item -->
<div class="food-item white"><!-- end:row -->
</div>
<!-- end:Food item -->
</div>
<!-- end:Collapse -->
</div>
</div>
<?php
}
}
}
}
}
?>
<!-- end:Widget menu -->
Code works but when i add more than 1 result im getting this
http://prntscr.com/fu3qll
Here is 1 cat and 2 topics in side it
https://prnt.sc/fu3g2j
works great but when i add 2 cats and 4 topics 2 inside each one i get above the fu3kbk link
so i fixed it by moving the bracket down on
$result2 = mysql_query($sql2);
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-6"><!-- end:Widget menu -->
<?php
///first select the category based on $_GET['cat_id']
$sql = "SELECT * FROM categories WHERE takeawayid =' ".$id1."'";
$result = mysql_query($sql);
if(!$result)
{
echo 'The category could not be displayed, please try again later.' . mysql_error();
}
else
{
if(mysql_num_rows($result) == 0)
{
echo 'This category does not exist.';
}
else
{
//display category data
while($row = mysql_fetch_assoc($result))
{
?>
<div class="menu-widget" id="2">
<div class="widget-heading">
<h3 class="widget-title text-dark">
<?php echo $row['cat_name'] ; ?> <a class="btn btn-link pull-right" data-toggle="collapse" href="#popular2" aria-expanded="true">
<i class="fa fa-angle-right pull-right"></i>
<i class="fa fa-angle-down pull-right"></i>
</a>
</h3>
<div class="clearfix"></div>
</div>
<?php
//do a query for the topics
$sql2 = "SELECT * FROM topics WHERE topic_cat =' ".$row['cat_id']."'";
$result2 = mysql_query($sql2);
if(!$result2)
{
echo 'The topics could not be displayed, please try again later.';
}
else
{
if(mysql_num_rows($result2) == 0)
{
echo 'There are no topics in this category yet.';
}
else
{
//prepare the table
while($row2 = mysql_fetch_assoc($result2))
{
?>
<div class="collapse in" id="popular2">
<div class="food-item">
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-8">
<div class="rest-logo pull-left">
<a class="restaurant-logo pull-left" href="#"><img src="http://geatzo.com/beta/restaurants/<?php echo $id33 ;?>.png" alt="Food logo"></a>
</div>
<!-- end:Logo -->
<div class="rest-descr">
<h6><?php echo $row2['topic_subject'] ;?></h6>
<p> Burgers, American, Sandwiches, Fast Food, BBQ</p>
</div>
<!-- end:Description -->
</div>
<!-- end:col -->
<div class="col-xs-12 col-sm-12 col-lg-4 pull-right item-cart-info"> <span class="price pull-left">$ 0</span> + </div>
</div>
<!-- end:row -->
</div>
<!-- end:Food item --><!-- end:Food item --><!-- end:Food item -->
<!-- end:Food item -->
</div>
<!-- end:Collapse -->
<?php
}
}
}
}
}
}
?>
</div>
</div>
<!-- end:Widget menu -->

Filter query results with checkboxes [PHP] [MYSQL]

In my site there is a page where is shown the content of my database (the list of all the locals). I would like to let the user filter the research, so I would like that my query that show the resoults can be modified by checkboxes. If a user select Vegan in the checkbox, the page must show only vegan locals. I don't have a form for the checkboxes so I don't know hot to handle the input.
I have two scripts: locals_page.php that is the main page with the filter boxes and table_generator.php that is a php script that do the query and retrieve the data, and show them into locals_page.php
I searched a lot to resolve this but I don't know how to start because I don't have a simple table for the resoults or a common form.
Maybe it's a generic question, but an help will be appreciated.
locals_page
<body>
<div class="container">
<div class="row">
<!--FILTERS PART-->
<div class="col-sm-3 col-md-3">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne"><span class="glyphicon glyphicon-folder-close">
</span>Kitchen type</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<table class="table">
<tr>
<td>
<input type="checkbox" name="Kebab" value="Kebab"> Kebab
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="Asiatic" value="Asiatic"> Asiatic
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="Vegan" value="Vegan"> Vegan
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo"><span class="glyphicon glyphicon-th">
</span>Local Type</a>
</h4>
</div>
<div id="collapseTwo" class="panel-collapse collapse">
<div class="panel-body">
<table class="table">
<tr>
<td>
<input type="checkbox" name="Restaurant" value="Restaurant"> Restaurant
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="Pub" value="Pub"> Pub
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<!--END FILTERS PART-->
<div class="col-sm-9 col-md-9">
<!--SCRIPT THAT GENERATE MY PAGE-->
<?php require_once('php\table_generator.php'); ?>
</div>
</div>
</div>
</body>
table_generator
<?php
echo '<section class="col-xs-12 col-sm-6 col-md-12">';
$sql = "SELECT nome_L, tipocucina_TC, wifi_L, tipolocale_TL, descrizione_L, indirizzo_L, fasciaprezzo_L, convenzione_L FROM locale l
JOIN tipocucina c On l.TipoCucina_L = c.IDtipocucina_TC
JOIN tipolocale t On l.TipoLocale_L = t.IDTipolocale_TL";
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
while ($row = mysqli_fetch_array($result)) {
$nome_Local = $row['nome_L'];
$descrizione_Local = $row['descrizione_L'];
$indirizzo_Local = $row['indirizzo_L'];
$tipocucina_Local = $row['tipocucina_TC'];
$tipolocale_Local = $row['tipolocale_TL'];
$wifi_Local = $row['wifi_L'];
$prezzo_Local = $row['fasciaprezzo_L'];
//Inizio article
echo '<article class="search-result row">
<div class="col-xs-12 col-sm-12 col-md-3">
<a class="thumbnail"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e6/Piadina.jpg/1200px-Piadina.jpg" alt="Lorem ipsum" /></a>
</div>
<div class="col-xs-12 col-sm-12 col-md-2" style="width: 18%;">
<ul class="meta-search">
<li><i class="fa fa-cutlery fa-lg"></i> <span>' . $tipocucina_Local . '</span></li>
<li><i class="fa fa-coffee fa-lg"></i> <span>' . $tipolocale_Local . '</span></li>
<li><i class="fa fa-coffee fa-lg"></i> <span>' . $wifi_Local . '</span></li>
<li><i class="fa fa-coffee fa-lg"></i> <span>' . $prezzo_Local . '</span></li>
</ul>
</div>
<div class="col-xs-12 col-sm-12 col-md-7 excerpet" style="width: 55%;">';
echo "<h3><a>" . $nome_Local . "</a></h3>";
echo '<i class="fa fa-compass"> </i>' . $indirizzo_Local . '</i>';
echo "<br>";
echo '<p class="local-description">' . $descrizione_Local . '</p>';
echo '
</div>
<span class="clearfix borda"></span>
</article>'; //Fine article
}
$conn->close();
echo "</section>";
?>
I don't know if javascript or ajax or jquery is needed. I don't ever know how to start. I hope my problem is understandable and that the code I put is helpful. Thank you so much in advice.

Categories