|
|
|
ช่วยแนะแนวทาง การแก้ไขหน่อยครับ เรื่องวันที่ กับ เวลา |
|
|
|
|
|
|
|
คือว่า วันที่ทำเปิดงานไปวันที่ 2013-10-25 เวลาเปิดงาน 12:45 เวลาปิดงานวันที่ 2013-10-26 เวลา 17:00 เวลารวมทั้งหมด มันได้แค่ 04:15
พอมีแนวทางแก้ไขไหมครับ
<?
$day = $_POST["day"];
$month = $_POST["month"];
$year = $_POST["year"];
$day2 = $_POST["day2"];
$month2 = $_POST["month2"];
$year2 = $_POST["year2"];
$customer = $_POST["customer"];
$total = "$year-$month-$day";
$total2 ="$year2-$month2-$day2";
include "connect.php";
$sql = "SELECT * FROM linkdown WHERE date BETWEEN '$total' AND '$total2' ORDER BY date ASC, linkdowntime ASC ";
$result = mysql_db_query($dbname, $sql);
print("<center>");?>
<table border="1" style="font-family: MS Sans Serif; FONT-SIZE: 10px; border-color: #000000; border-width: 1px;">
<tr bgcolor=Silver align=center style = "font-weight: bold;">
<td>วันที่</td>
<td>Ticket ID</td>
<td>Circuit ID</td>
<td>ชื่อลูกค้า</td>
<td>สาขา</td>
<td>วงจรและความเร็ว</td>
<td>Link Down Time</td>
<td>Link Up Time</td>
<td>Down Time</td>
<td>เจ้าหน้าที่รับแจ้ง</td>
<td>ผู้แจ้ง</td>
<td>หมายเหตุ</td>
</tr>
<?
$customer2 = $customer;
while($record = mysql_fetch_assoc($result))
{
$note = $record["customerid"];
if($customer2 == "0")
{
$sql2 = "SELECT * FROM customer WHERE circuitid ='$note' ";
}else{
$sql2 = "SELECT * FROM customer WHERE circuitid ='$note' AND customer = '$customer' ";
}
$result2 = mysql_db_query($dbname, $sql2);
while($record2 = mysql_fetch_assoc($result2))
{
$datea = $record["date"];
$ticket = $record["ticketid"];
$circuitid = $record["customerid"];
$customer = $record2["customer"];
$major = $record2["major"];
$speed = $record2["speed"];
$linkdown = $record["linkdowntime"];
$linkup = $record["linkuptime"];
$reciev = $record["recieverinfo"];
$person = $record["personinfo"];
$memo = $record["memo"];
$time1 = "$linkup";
$time2 = "$linkdown";
$cal_time = date("U",mktime(date(substr($time1,0,2)-substr($time2,0,2)),date(substr($time1,3,2)-substr($time2,3,2))));
$time3= date("H.i",$cal_time) ;
if($time3 >= "3")
{$timelink = "<center><font color=red><B>$time3</B></font></center>";}else{
$timelink = $time3;}
if($time3 >= "3")
{$date1 = "<center><font color=red><B>$datea</B></font></center>";}else{
$date1 = $datea;}
if($time3 >= "3")
{$ticket1 = "<center><font color=red><B>$ticket</B></font></center>";}else{
$ticket1 = $ticket;}
if($time3 >= "3")
{$circuitid1 = "<center><font color=red><B>$circuitid</B></font></center>";}else{
$circuitid1 = $circuitid;}
if($time3 >= "3")
{$customer1 = "<center><font color=red><B>$customer</B></font></center>";}else{
$customer1 = $customer;}
if($time3 >= "3")
{$major1 = "<center><font color=red><B>$major</B></font></center>";}else{
$major1 = $major;}
if($time3 >= "3")
{$speed1 = "<center><font color=red><B>$speed</B></font></center>";}else{
$speed1 = $speed;}
if($time3 >= "3")
{$linkdown1 = "<center><font color=red><B>$linkdown</B></font></center>";}else{
$linkdown1 = $linkdown;}
if($time3 >= "3")
{$linkup1 = "<center><font color=red><B>$linkup</B></font></center>";}else{
$linkup1 = $linkup;}
if($time3 >= "3")
{$reciev1 = "<center><font color=red><B>$reciev</B></font></center>";}else{
$reciev1 = $reciev;}
if($time3 >= "3")
{$person1 = "<center><font color=red><B>$person</B></font></center>";}else{
$person1 = $person;}
if($time3 >= "3")
{$memo1 = "<center><font color=red><B>$memo</B></font></center>";}else{
$memo1 = $memo;}
echo "<tr align=center>
<td>$date1</td>
<td>$ticket1</td>
<td>$circuitid1</td>
<td>$customer1</td>
<td>$major1</td>
<td>$speed1</td>
<td>$linkdown1</td>
<td>$linkup1</td>
<td>$timelink</td>
<td>$reciev1</td>
<td>$person1</td>
<td>$memo1</td>
</tr>";
}
}
print("</table></center>");
mysql_close();
?>
31026130436.png[/img]
Tag : PHP
|
|
|
|
|
|
Date :
2013-10-26 13:21:51 |
By :
jom |
View :
5588 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตอนเก็บ เก็บวันด้วยไหมครับ
|
|
|
|
|
Date :
2013-10-26 13:57:37 |
By :
anotherdie |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่ได้เก็บวันอะครับ
|
|
|
|
|
Date :
2013-10-26 14:32:13 |
By :
jom |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
รบกวนช่วยสมัครสมาชิกและกลับมากด [ส่งคำขอบคุณ] เมื่อได้รับคำตอบด้วยน่ะครับ
Code (PHP)
<?php
$datetime1 = new DateTime('2013-10-25 12:45');
$datetime2 = new DateTime('2013-10-26 17:00');
$intervalTime = $datetime1->diff($datetime2);
echo $intervalTime->format('%R%a days %h:%i:%s');
?>
|
|
|
|
|
Date :
2013-10-26 21:40:55 |
By :
sakuraei |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|