I am trying to retrieve data from a database and display it on the PHP file using the following code:
index.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Control Panel</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link href="css/font-awesome.min.css" rel="stylesheet">
<!-- NProgress -->
<link href="css/nprogress.css" rel="stylesheet">
<!-- iCheck -->
<link href="css/green.css" rel="stylesheet">
<!-- Datatables -->
<link href="css/dataTables.bootstrap.min.css" rel="stylesheet">
<link href="css/buttons.bootstrap.min.css" rel="stylesheet">
<link href="css/fixedHeader.bootstrap.min.css" rel="stylesheet">
<link href="css/responsive.bootstrap.min.css" rel="stylesheet">
<link href="css/scroller.bootstrap.min.css" rel="stylesheet">
<!-- Custom Theme Style -->
<link href="css/custom.min.css" rel="stylesheet">
</head>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<div class="col-md-12 left_col">
<div class="left_col scroll-view">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_content">
<?php
$count_rows = 0;
include 'database_connection.php';
$sql = "SELECT date, ip, activate FROM software";
$result = $conn->query($sql);
echo "<table id='datatable-buttons class='table table-striped table-bordered'>
<tr>
<th>S/N</th>
<th>Date</th>
<th>IP Address</th>
<th>Activation</th>
</tr>";
while ($row = mysqli_fetch_array($result)) {
$count_rows++;
echo "<tr>";
echo "<td>" . $count_rows . "</td>";
echo "<td>" . $row['date'] . "</td>";
echo "<td>" . $row['ip'] . "</td>";
echo "<td>" . $row['activate'] . "</td>";
echo "</tr>";
}
mysqli_close($conn);
?>
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="js/fastclick.js"></script>
<!-- NProgress -->
<script src="js/nprogress.js"></script>
<!-- iCheck -->
<script src="js/icheck.min.js"></script>
<!-- Datatables -->
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/dataTables.buttons.min.js"></script>
<script src="js/buttons.bootstrap.min.js"></script>
<script src="js/buttons.flash.min.js"></script>
<script src="js/buttons.html5.min.js"></script>
<script src="js/buttons.print.min.js"></script>
<script src="js/dataTables.fixedHeader.min.js"></script>
<script src="js/dataTables.keyTable.min.js"></script>
<script src="js/dataTables.responsive.min.js"></script>
<script src="js/responsive.bootstrap.js"></script>
<script src="js/dataTables.scroller.min.js"></script>
<script src="js/jszip.min.js"></script>
<script src="js/pdfmake.min.js"></script>
<script src="js/vfs_fonts.js"></script>
<!-- Custom Theme Scripts -->
<script src="js/custom.min.js"></script>
</body>
</html>
I am getting the results but it's not properly formatted. With almost the same code I can get the design but not the data: Here's the code that is working but not showing the data.
index.html (Incomplete code)
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Control Panel</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link href="css/font-awesome.min.css" rel="stylesheet">
<!-- NProgress -->
<link href="css/nprogress.css" rel="stylesheet">
<!-- iCheck -->
<link href="css/green.css" rel="stylesheet">
<!-- Datatables -->
<link href="css/dataTables.bootstrap.min.css" rel="stylesheet">
<link href="css/buttons.bootstrap.min.css" rel="stylesheet">
<link href="css/fixedHeader.bootstrap.min.css" rel="stylesheet">
<link href="css/responsive.bootstrap.min.css" rel="stylesheet">
<link href="css/scroller.bootstrap.min.css" rel="stylesheet">
<!-- Custom Theme Style -->
<link href="css/custom.min.css" rel="stylesheet">
</head>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<div class="col-md-12 left_col">
<div class="left_col scroll-view">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_content">
<table id="datatable-buttons" class="table table-striped table-bordered">
<thead>
<tr>
<th>S/N</th>
<th>Date</th>
<th>IP Address</th>
<th>Activation</th>
</tr>
</thead>
<tbody>
<tr>;
<td> $row['id'] </td>
<td> $row['date'] </td>
<td> $row['ip'] </td>
<td> $row['activate'] </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="js/fastclick.js"></script>
<!-- NProgress -->
<script src="js/nprogress.js"></script>
<!-- iCheck -->
<script src="js/icheck.min.js"></script>
<!-- Datatables -->
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/dataTables.buttons.min.js"></script>
<script src="js/buttons.bootstrap.min.js"></script>
<script src="js/buttons.flash.min.js"></script>
<script src="js/buttons.html5.min.js"></script>
<script src="js/buttons.print.min.js"></script>
<script src="js/dataTables.fixedHeader.min.js"></script>
<script src="js/dataTables.keyTable.min.js"></script>
<script src="js/dataTables.responsive.min.js"></script>
<script src="js/responsive.bootstrap.js"></script>
<script src="js/dataTables.scroller.min.js"></script>
<script src="js/jszip.min.js"></script>
<script src="js/pdfmake.min.js"></script>
<script src="js/vfs_fonts.js"></script>
<!-- Custom Theme Scripts -->
<script src="js/custom.min.js"></script>
</body>
</html>
Of course I know that the index.html code is Incorrect or incomplete. However it does load the bootstrap table design perfectly. What am I doing on the PHP file?
Please guide me here.
Screenshot of index.php : http://oi65.tinypic.com/z7ed3.jpg
Screenshot of index.html: http://oi68.tinypic.com/2zqqvc6.jpg
Please change your code in index.php file:
<table id='datatable-buttons class='table table-striped table-bordered'>
to
<table id='datatable-buttons' class='table table-striped table-bordered'>
you didn't close quote after id datatable-buttons
and add </table> after the end of while block
In your case, you can change your code to code below:
<table id="datatable-buttons" class="table table-striped table-bordered">
<thead>
<tr>
<th>S/N</th>
<th>Date</th>
<th>IP Address</th>
<th>Activation</th>
</tr>
</thead>
<tbody>
<?php
$count_rows = 0;
include 'database_connection.php';
$sql = "SELECT `date`, `ip`, `activate` FROM `software`";
$result = $conn->query($sql);
while ($row = mysqli_fetch_array($result)):
$count_rows++;
?>
<tr>
<td><?php echo $count_rows ?></td>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['date']; ?></td>
<td><?php echo $row['ip']; ?></td>
<td><?php echo $row['activate']; ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
Related
I am creating a webapp for my company and one of my PHP pages keeps on
loading when I add another header.php into it, but another page is loading fine if I add this header.
my code: this section is added to the below page (view_enquiry.php)
head.php:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<!-- Favicon icon -->
<link rel="icon" type="image/png" sizes="16x16" href="images/logo.png">
<?php
include('connect.php');
$sql_head_title = "select * from manage_website";
$result_head_title = $conn->query($sql_head_title);
$row_head_title = mysqli_fetch_array($result_head_title);
?>
<title><?php echo $row_head_title['title'];?></title>
<link href="css/lib/chartist/chartist.min.css" rel="stylesheet">
<link href="css/lib/owl.carousel.min.css" rel="stylesheet" />
<link href="css/lib/owl.theme.default.min.css" rel="stylesheet" />
<!-- Bootstrap Core CSS -->
<link href="css/lib/bootstrap/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/helper.css" rel="stylesheet">
<link href="css/snackbar.css" rel="stylesheet">
<link href="css/modal.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:** -->
<!--[if lt IE 9]>
<script src="https:**oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https:**oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" href="css/lib/html5-editor/bootstrap-wysihtml5.css" />
<link href="css/lib/calendar2/semantic.ui.min.css" rel="stylesheet">
<link href="css/lib/calendar2/pignose.calendar.min.css" rel="stylesheet">
</head>
<body class="fix-header fix-sidebar">
<!-- Preloader - style you can find in spinners.css -->
<div class="preloader">
<svg class="circular" viewBox="25 25 50 50">
<circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" /> </svg>
</div>
</body>
</html>
this is my page and this page keeps on loading (view_enquiry.php)
<?php include('head.php');?>
<?php include('header.php');?>
<?php include('sidebar.php');?>
<?php
include ('connect.php');
?>
<div class="content-wrapper" style="padding-top: 48px;">
<div class="container-fluid">
<div class="status" style="color:red;position: relative;top:215px;positin: relative;left:565px;position:absolute;">
<h4>Status Updated Successfully</h4>
</div>
<div class="row" col-sm color: #031aaf" style="padding-top: 12px;">
<div class="col-sm-3">
<h3 style="color: #828282"><b>Enquiry Details</b></h3>
</div>
<div class="col-sm-3">
<form action="" method="get" " >
<input name="search" type="text" placeholder="Search(Name/number)" size="20px">
<button type="submit" name="submit" value="search" class="button"><i class="fa fa-search"></i></button>
</form>
</div>
<div class="col-sm-5" style="text-align: left;">
<form action="between.php" method="GET" >
<input type="date" name="from" required> To
<input type="date" name="to" required>
<button type="submit" class="button"><i class="fa fa-search"></i></button>
</form>
</div>
</div>
<b><p style="text-align:right; color: #828282" > Yesterday's Enquiry Count :
<?php
$v="SELECT COUNT(id) FROM task WHERE (`date` = CURDATE() - INTERVAL 1 DAY)AND completed=0" ;
$s=mysqli_query($conn,$v);
$w=mysqli_fetch_assoc($s);
echo $w['COUNT(id)'] ;
?>
</b>
<br><br>
<table border="1px;" style="margin-top:-11px;color: #333333" bgcolor="#fcb983" >
<tr style="color: black">
<th></th>
<th>Name</th>
<th>Address</th>
<th>Enquiry Date</th>
<th>Category/Work</th>
<th>Followup Date</th>
<th>Mobile</th>
<th>Comment</th>
<th>Postponed To</th>
<th>Edit</th>
<th>Delete</th>
<th>Complete</th>
</tr>
<?php
if(#$_GET['search'] && #$_GET['search']!=''){
$query=$_GET['search'];
$query = htmlspecialchars($query);
$vari = mysqli_query($conn,"SELECT * FROM task WHERE completed=0 AND ((`task_name` LIKE '%".$query."%') OR (`mobile` LIKE '%".$query."%') OR (`address` LIKE '%".$query."%') OR (`work` LIKE '%".$query."%') OR (`command` LIKE '%".$query."%'))") or die(mysqli_error($con));
//$vari="SELECT * FROM task WHERE completed=0 AND (task_name='$s' OR mobile='$s')";
}
else{
$vari = mysqli_query($conn,"SELECT * FROM task WHERE (`date` = CURDATE() - INTERVAL 1 DAY) AND completed=0") or die(mysqli_error($conn));
//$vari="SELECT * FROM task WHERE completed=0";
}
//$variable=mysqli_query($con,$vari);
while ($row = mysqli_fetch_array($vari)){
?>
<tr>
<td><span class="glyphicon glyphicon-chevron-right"></span></td>
<td><?php echo $row["task_name"]; ?></td>
<td><?php echo $row["address"]; ?></td>
<td><?php echo date('d-m-Y',strtotime($row["date"])); ?></td>
<td><?php echo $row["work"];?></td>
<td><?php echo date('D - d-m-Y',strtotime($row["todo"])); ?></td>
<td><?php echo $row["mobile"] ;?></td>
<td><?php echo $row["command"];?></td>
<td></span></center></td>
<td></span></center></td>
<td><center><span class="fa fa-trash"></span></center></td>
<td><center><span class="fa fa-check-square"></span></center></td>
</tr>
<?php } ?>
</table>
</div>
</div>
Please help me this details
I want to fetch records from database in category field with a button next to it, and when I click on that button there is a bootstrap collapse on which I have to display records from another database which is the sub-category of that specific category field and it should dynamically fetch the records as per above category field., and will be keep on changing when changes done from admin side. I want to write PHP code in SQL query, below code shows no error but does not provides me the expected outcome. Please Help me friends.
<?php
$conn = mysqli_connect("localhost","root","","zuuvee");
$query = mysqli_query($conn, "SELECT * FROM category_name");
$query1 = mysqli_query($conn, "SELECT * FROM subcategory_name WHERE category = 'Apparel & Accessories'");
?>
<!DOCTYPE html>
<html>
<head>
<title>Category</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
</head>
<body>
<?php
while ($row = mysqli_fetch_array($query))
{
?>
<ul>
<li>
<span class="number"><?php echo $row['ID']; ?></span>
<span><a class="btn btn-primary" data-toggle="collapse" href="#third<?php echo $row['ID']; ?>" aria-expanded="false"></a>
<span><label name ="lb1"><?php echo $row['name']; ?></label></span>
<div class="collapse" id="third<?php echo $row['ID']; ?>">
<div class="card" style="width: 18rem;">
<div class="card-body">
<?php
while ($row1 = mysqli_fetch_array($query1))
{
?>
<h5 class="card-title"><?php echo $row1['subcategory']; ?></h5>
<?php
}
?>
</div>
</div>
</div></span>
<span class="points">00</span>
<span class="badge"><i class= "fa fa-microchip" aria-hidden="true"></i></span>
</li>
</ul>
<?php
}
?>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
</body>
</html>
I have a quote table that people insert basic information, such as name, product type etc. Which is all fine.
The admin can see the quote table and has a button to view the information in a structured manner.
Now what i have been trying to do is add a button called "Accept" and "Deny" which would move the table entry to the Denied or accepted table (same structure as the quote table)
I have looked around on google but only found assistance in making a button to delete entries or add new entries.
Below is the admin quote viewing page code with the view button:
<?php
session_start();
include("dbconnection.php");
include("checklogin.php");
check_login();
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta charset="utf-8" />
<title>Admin | Manage Logged Claims</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta content="" name="description" />
<meta content="" name="author" />
<link href="assets/plugins/bootstrap-select2/select2.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/plugins/jquery-datatable/css/jquery.dataTables.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/datatables-responsive/css/datatables.responsive.css"
rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/plugins/boostrapv3/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/boostrapv3/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/animate.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/jquery-scrollbar/jquery.scrollbar.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/style.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/responsive.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/custom-icon-set.css" rel="stylesheet" type="text/css"/>
</head>
<body class="">
<?php include("header.php");?>
<div class="page-container row">
<?php include("leftbar.php");?>
<div class="clearfix"></div>
<!-- END SIDEBAR MENU -->
</div>
</div>
<div class="page-content">
<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<div id="portlet-config" class="modal hide">
<div class="modal-header">
<button data-dismiss="modal" class="close" type="button"></button>
<h3>Widget Settings</h3>
</div>
<div class="modal-body"> Widget settings form goes here </div>
</div>
<div class="clearfix"></div>
<div class="content">
<ul class="breadcrumb">
<li>
<p>YOU ARE HERE</p>
</li>
<li>Claims Logged </li>
</ul>
<div class="page-title"> <i class="icon-custom-left"></i>
<h3>Manage Logged Claims</h3>
</div>
<div class="row-fluid">
<div class="span12">
<div class="grid simple ">
<div class="grid-title">
<h4>Table <span class="semi-bold">Styles</span></h4>
<div class="tools">
<a href="javascript:;" class="remove">
</a> </div>
</div>
<div class="grid-body ">
<table class="table table-hover table-condensed" id="example">
<thead>
<tr>
<th style="width:1%">#</th>
<th style="width:10%">Name</th>
<th style="width:10%" data-hide="phone,tablet">Email</th>
<th style="width:10%">Contact no</th>
<th style="width:20%" data-hide="phone,tablet">Claim Requested</th>
<th style="width:10%">Action </th>
</tr>
</thead>
<tbody>
<?php $ret=mysql_query("select * from prequest order by id desc");
$cnt=1;
while($row=mysql_fetch_array($ret))
{?>
<tr >
<td class="v-align-middle"><?php echo $cnt;?></td>
<td class="v-align-middle"><?php echo $row['name'];?></td>
<td class="v-align-middle"><span class="muted"><?php echo $row['email'];?></span></td>
<td><span class="muted"><?php echo $row['contactno'];?>
</span></td>
<td class="v-align-middle"><?php echo $row['wdd'];?>
<?php echo $row['cms'];?>
<?php echo $row['seo'];?>
<?php echo $row['smo'];?>
<?php echo $row['swd'];?>
<?php echo $row['dwd'];?>
<?php echo $row['fwd'];?>
<?php echo $row['dr'];?>
<?php echo $row['whs'];?>
<?php echo $row['wm'];?>
<?php echo $row['ed'];?>
<?php echo $row['wta'];?>
<?php echo $row['opi'];?>
<?php echo $row['ld'];?>
<?php echo $row['da'];?>
<?php echo $row['osc'];?>
<?php echo $row['nd'];?>
<?php echo $row['others'];?>
</td>
<td><button class="btn-danger-dark">View</button></td> <--VIEW BUTTON
</tr>
<?php $cnt=$cnt+1; } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="addNewRow"></div>
</div>
</div>
<script src="assets/plugins/jquery-1.8.3.min.js" type="text/javascript">
</script>
<script src="assets/plugins/jquery-ui/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>
<script src="assets/plugins/boostrapv3/js/bootstrap.min.js" type="text/javascript"></script>
<script src="assets/plugins/breakpoints.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-unveil/jquery.unveil.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-scrollbar/jquery.scrollbar.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-block-ui/jqueryblockui.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-numberAnimate/jquery.animateNumbers.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-select2/select2.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-datatable/js/jquery.dataTables.min.js" type="text/javascript" ></script>
<script src="assets/plugins/jquery-datatable/extra/js/dataTables.tableTools.min.js" type="text/javascript" >
</script>
<script type="text/javascript" src="assets/plugins/datatables-responsive/js/datatables.responsive.js"></script>
<script type="text/javascript" src="assets/plugins/datatables-responsive/js/lodash.min.js"></script>
<script src="assets/js/datatables.js" type="text/javascript"></script>
<script src="assets/js/core.js" type="text/javascript"></script>
<script src="assets/js/chat.js" type="text/javascript"></script>
<script src="assets/js/demo.js" type="text/javascript"></script>
</body>
</html>
Have you considered a different approach?
If the two tables have the exact same structure, then all you need is a single table and add a column called 'accepted' and use 1 and 0 values to act as true and false.
Then you can search this single table WHERE 'accepted' = 1 for accepted entries, or 0 for denied entries. And to change an entry's status, simply update a single column. Much easier.
Example:
$result = mysqli_query("SELECT * FROM tableName WHERE accepted = 1");
That will get only entries you have marked as accepted.
Change it to WHERE accepted = 0" to get the denied entries.
And here is how you can allow the admin to change an entry's accepted/denied status easily:
$update = mysqli_query("UPDATE tableName SET accepted = 1 WHERE id = 12345");
By the way, I suggest you use mysqli instead of mysql, heres a good answer why.
I need to print the following page :
But the result is not as expected :
It seems like my bootstrap css is not used when I print the webpage.
This is the HTML code of my page :
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Route Du Drive</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Le styles -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" media="screen" rel="stylesheet" type="text/css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="/metronic/global/plugins/simple-line-icons/simple-line-icons.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="/metronic/global/plugins/bootstrap/css/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="/metronic/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="/img/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">
<link href="/metronic/global/css/components-md.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="/metronic/global/css/plugins-md.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="/metronic/pages/css/login-4.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="/css/global.css" media="screen" rel="stylesheet" type="text/css">
<!-- Scripts -->
</head>
<body cz-shortcut-listen="true">
<header>
</header>
<div class="row">
<div class="col-xs-1"></div>
<div class="col-xs-3">
<h3>Commande N°O001</h3>
<h4>Boulangerie Ange Oceanis</h4>
<h4>1 Rue de la Côte de Nacre</h4>
<h4>44600 Saint-Nazaire</h4>
</div>
<div class="col-xs-1"></div> <div class="col-xs-3"><h3>Commande archivée</h3></div>
<div class="col-xs-3">
<h3>Nom du client</h3>
</div>
</div>
<div class="row">
<div class="col-xs-1"></div>
<div class="col-xs-10">
<h3 class="text-center">Articles commandés</h3>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Check</th>
<th>Référence</th>
<th>Dénomination</th>
<th>Prix unitaire</th>
<th>Quantité</th>
<th>Cout</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>PAIN</td>
<td>Baguette de pain</td>
<td>0.93 €</td>
<td>9</td>
<td>8.37 €</td>
</tr>
<tr>
<td colspan="4"></td>
<td><b>Total commande</b></td>
<td>8.37 €</td>
</tr>
</tbody>
</table>
<i class="fa fa-arrow-left" aria-hidden="true"></i> Retour à la page précédente
</div>
<script type="text/javascript" src="/js/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="/js/global.js"></script>
<script type="text/javascript" src="/metronic/global/plugins/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="/metronic/global/plugins/js.cookie.min.js"></script>
<script type="text/javascript" src="/metronic/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<script type="text/javascript" src="/metronic/global/plugins/jquery.blockui.min.js"></script>
<script type="text/javascript" src="/metronic/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js"></script>
<script type="text/javascript" src="/metronic/global/plugins/backstretch/jquery.backstretch.min.js"></script>
<script type="text/javascript" src="/metronic/global/scripts/app.min.js"></script>
How can I print the page with the original styling?
Does someone have an idea what is causing the problem?
Try to locate the following line:
<link href="/metronic/global/plugins/bootstrap/css/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css">
and change it to
<link href="/metronic/global/plugins/bootstrap/css/bootstrap.min.css" media="all" rel="stylesheet" type="text/css">
The changes is on the media="screen" to media="all". This change will ensure that the same styling for both displaying the page on the screen as well as on your print.
Read more on the media attribute here or here on MDN.
im using laravel and blade for templates. I have a problem, i have a base template called (base.blade.php), where i include all js files (jQuery too).
The problem comes when im child template (myadpack.blade.php extends from base.blade.php). I want to use jQuery in child, but it seems to be impossible, i can do normal js calls, but not using jQuery (that is included in parent). I paste these files here:
base.blade.php
<!DOCTYPE HTML>
<html>
<head>
<title>Tonhits</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="{{ asset('css/font-awesome.min.css') }}" />
<link rel="stylesheet" href="{{ asset('css/bootstrap-theme.css') }}" />
<link rel="stylesheet" href="{{ asset('css/main.css') }}" />
<link rel="stylesheet" href="{{ asset('css/table.css') }}" />
<link rel="stylesheet" href="{{ asset('css/tablesaw.css') }}" />
<link rel="stylesheet" href="{{ asset('http://cdn.datatables.net/1.10.11/css/jquery.dataTables.min.css') }}" />
#section('css')
#show
</head>
<body class="no-sidebar">
<div id="page-wrapper">
<!-- Header Wrapper -->
<div id="header-wrapper">
<!-- Header -->
<div id="header" class="container">
<!-- Logo -->
<h1><a id="logo">Tonhits</a></h1>
<!-- Nav -->
#include('nav/nav_anon')
</div>
</div>
<!-- Main Wrapper -->
<div id="main-wrapper">
<!-- Main -->
<div id="page" class="container">
<!-- Main Heading -->
<div class="title-heading">
<h2>#yield('titleBig')</h2>
<p> #yield('titleSmall')</p>
</div>
<!-- Main Content -->
<div id="main">
<div class="row">
<div id="content" class="12u">
<!-- <header>
<h2>Nunc fringilla dis natoque amet gravida turpis</h2>
</header> -->
#section('content')
#show
</div>
</div>
</div>
<!-- Main Content -->
</div>
<!-- Main -->
</div>
<!-- Copyright -->
<div id="copyright">
Tonhits. All rights reserved
</div>
</div>
<!-- Scripts -->
<script src="{{ asset('js/jquery.min.js') }}"></script>
<script src="{{ asset('js/jquery.dropotron.min.js') }}"></script>
<script src="{{ asset('js/skel.min.js') }}"></script>
<script src="{{ asset('js/util.js') }}"></script>
<script src="{{ asset('js/main.js') }}"></script>
<script src="{{ asset('js/tablesaw.js') }}"></script>
<script src="{{ asset('http://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js') }}"></script>
#yield('js')
</body>
</html>
myadpack.blade.php
#extends('base')
#section('titleBig', 'Me')
#section('titleSmall', 'My adpack overwiev')
</script>
#section('js')
<script type="text/javascript" >
$(document).on('ready', function(){
alert("a");
});
</script>
#endsection
#section('content')
Here you can see your purchased adpacks, so you can have a detailed tracing.
<table id="adpacks">
<tr>
<th>Test</th>
<th>Test</th>
</tr>
<tr>
<td>Data</td>
<td>Data 2</td>
</tr>
</table>
#endsection
In parent i tried with yield, section, and nothing.
What it could be?
Thank you for reading me.
base.blade.php
<!DOCTYPE HTML>
<html>
<head>
<title>Tonhits</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="{{ asset('css/font-awesome.min.css') }}" />
<link rel="stylesheet" href="{{ asset('css/bootstrap-theme.css') }}" />
<link rel="stylesheet" href="{{ asset('css/main.css') }}" />
<link rel="stylesheet" href="{{ asset('css/table.css') }}" />
<link rel="stylesheet" href="{{ asset('css/tablesaw.css') }}" />
<link rel="stylesheet" href="http://cdn.datatables.net/1.10.11/css/jquery.dataTables.min.css" />
#yield('css')
</head>
<body class="no-sidebar">
<div id="page-wrapper">
<!-- Header Wrapper -->
<div id="header-wrapper">
<!-- Header -->
<div id="header" class="container">
<!-- Logo -->
<h1><a id="logo">Tonhits</a></h1>
<!-- Nav -->
#include('nav/nav_anon')
</div>
</div>
<!-- Main Wrapper -->
<div id="main-wrapper">
<!-- Main -->
<div id="page" class="container">
<!-- Main Heading -->
<div class="title-heading">
<h2>#yield('titleBig')</h2>
<p> #yield('titleSmall')</p>
</div>
<!-- Main Content -->
<div id="main">
<div class="row">
<div id="content" class="12u">
<!-- <header>
<h2>Nunc fringilla dis natoque amet gravida turpis</h2>
</header> -->
#yield('content')
</div>
</div>
</div>
<!-- Main Content -->
</div>
<!-- Main -->
</div>
<!-- Copyright -->
<div id="copyright">
Tonhits. All rights reserved
</div>
</div>
<!-- Scripts -->
<script src="{{ asset('js/jquery.min.js') }}"></script>
<script src="{{ asset('js/jquery.dropotron.min.js') }}"></script>
<script src="{{ asset('js/skel.min.js') }}"></script>
<script src="{{ asset('js/util.js') }}"></script>
<script src="{{ asset('js/main.js') }}"></script>
<script src="{{ asset('js/tablesaw.js') }}"></script>
<script src="http://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js"></script>
#yield('js')
</body>
</html>
myadpack.blade.php
#extends('base')
#section('titleBig', 'Me')
#section('titleSmall', 'My adpack overwiev')
#section('content')
Here you can see your purchased adpacks, so you can have a detailed tracing.
<table id="adpacks">
<tr>
<th>Test</th>
<th>Test</th>
</tr>
<tr>
<td>Data</td>
<td>Data 2</td>
</tr>
</table>
#endsection
#section('js')
<script type="text/javascript">
$(document).on('ready', function() {
alert("a");
});
</script>
#endsection