这是用于从mysql数据库检索查询的php代码。据我所知,这没有错误。不幸的是,这不起作用。我找不到错误。
<?php
if(isset($_POST['submit'])) // submit is submit button name as POST method
{
$username = $_POST['in'];
$Timein= date("Y-m-d H:i:s",strtotime(str_replace('/','-',$username))); // converting into mysql datetime format
$username = $_POST['out'];
$Timeout = date("Y-m-d H:i:s",strtotime(str_replace('/','-',$username)));
$dbc = mysqli_connect('localhost','dev','dev@123','Database') or die('Error while connecting Database'.mysql_connect_error);
// connection to database
$q="select * from camera where NOT chkin > '$Timein' AND NOT chkout < '$Timeout'";
$r = mysqli_query($dbc,$q);
// query
while ($data = mysqli_fetch_assoc($r)){ ?>
// printing a bootstrap grid
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-6 col-xxs-12">
<div class="tm-tours-box-2">
<img src="img/index-0 <?php echo $data['id'];?>.jpg" alt="image" class="img-responsive">
<div class="tm-tours-box-2-info">
<h3 class="margin-bottom-15"><?php echo $data['name']; ?></h3>
<p>Rs <?php echo $data['price']; ?>/day</p>
</div>
<a class="tm-tours-box-2-link" onclick="POP()">Book Now</a>
</div>
</div>
<?php
}
}
?>