如何使用MySql和PHP绘制图形条线?
我试图在wordpress站点中使用MySql和PHP在一个单条中显示一个图形栏,以显示特定日期的可用座位与总座位 我的表格加价:如何使用MySql和PHP绘制图形条线?,php,mysql,graph,progress-bar,Php,Mysql,Graph,Progress Bar,我试图在wordpress站点中使用MySql和PHP在一个单条中显示一个图形栏,以显示特定日期的可用座位与总座位 我的表格加价: <strong>Check your desired date if it is available already in the system.</strong><br/><br/> <form action="<?php echo get_permalink();?>" method="post"
<strong>Check your desired date if it is available already in the system.</strong><br/><br/>
<form action="<?php echo get_permalink();?>" method="post" class="van_sharing_reference">
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('.search_input_text_van').datepicker({
dateFormat : 'yy-mm-dd'
});
});
</script>
<input type="text" placeholder="Select the date" required name="search_text" class="search_input_text_van">
<span class="arrow">
<input type="submit" value="CHECK" name="search" class="search_button">
</span>
</form>
如果系统中已有所需日期,请检查该日期。
你不想用谷歌图表之类的东西吗?是的。。。没有任何图书馆。。。或者谷歌图表..那
是的。。谢谢你的建议。。看起来不错。。。但是我怎样才能改变背景颜色呢?如何从行数动态更改第二行的宽度(百分比)??
<?PHP
if (isset($_POST['search'])){
$serch_text = $_POST["search_text"];
$con=mysqli_connect("localhost","db_name","db_username","db_password");
// Check connection
if (mysqli_connect_errno()) {
die ("Failed to connect to MySQL: " . mysqli_connect_error());
}
$booking_id_serch_text = $serch_text;
$searchroute = "select * from van_sharing where date = '$booking_id_serch_text'";
$result = $con->query($searchroute);
$row = $result->fetch_assoc();
if ($row == 0) { echo '<div style="color: red;">No one planned yet on the date <b>' . $serch_text . '</b>. to go</div>' ;
} else {
// getting number of rows for a specific date
$wpdb->get_results( $wpdb->prepare('select * from van_sharing where date = %s', $booking_id_serch_text));
$total_seats = 10;
$people_travel_on_the_date = $wpdb->num_rows;
$available_seats = $total_seats - $people_travel_on_the_date;
echo 'Total Seats ' . $total_seats . '<br/>';
echo 'Number of people who are planning to share on the date '.$booking_id_serch_text .' : '.$wpdb->num_rows;
echo '</br>Available seats : '.$available_seats;
mysqli_close($con);
}
}
?>