|
 |
|
ช่วยดูให้หน่อยค่ะเวลาเลือกวันที่เป็นวันเดือนปี แต่พอบันทึกอยากให้มันเป็นปีเดือนวัน ควรทำยังไงค่ะ ตอนนี้มันยังเป็น 0000-00-00 ในฐานข้อมูลค่ะ |
|
 |
|
|
 |
 |
|
ช่วยดูให้หน่อยค่ะเวลาเลือกวันที่เป็นวันเดือนปี แต่พอบันทึกอยากให้มันเป็นปีเดือนวัน ควรทำยังไงค่ะ ตอนนี้มันยังเป็น0000-00-00ในฐานข้อมูลค่ะ

Code (reserv_room)
<input name="dateService" type="text" id="dateService" value="<?php echo $data["dateService"] ?>" size="15" maxlength="20" readonly="readonly"/>
<input type="button" name="Submit5" value="....." onclick="showCalendar('dateService','DD-MM-YY')" />
Code (reserv_roomsave)
<?php
session_start();
$ses_userID = $_SESSION["ses_userID"];
?>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620" />
<?php
include("config.php");
$subject=$_REQUEST["subject"];
$now = date("Y-m-d ");
$dateService=$_REQUEST["dateService"];
$timeIn=$_REQUEST["timeIn1"].':'.$_REQUEST["timeIn2"];
$timeOut=$_REQUEST["timeOut1"].':'.$_REQUEST["timeOut2"];
$classID=$_REQUEST["classID"];
$departmentsID = $_REQUEST['parent_dep'];
$branchID=$_REQUEST["sub_branch"];
$amount=$_REQUEST["amount"];
$equipment = $_REQUEST["equipment"];
$detail=$_REQUEST["detail"];
$sql="INSERT INTO reservroom(serviceID,subject,dateSave,dateService,timeIn,timeOut,userID,classID,departmentsID,branchID,amount,equipment,detail)";
$sql.="VALUES ('','$subject','$now','$dateService','$timeIn','$timeOut','$ses_userID','$classID','$departmentsID','$branchID','$amount','$equipment
','$detail')";
mysql_query($sql,$conn)
or die("ไม่สามารถเพิ่มข้อมูลลงสู่ตาราง reservroom ได้".mysql_error());
//echo "การเพิ่มข้อมูลสมบูรณ์";
echo "<meta http-equiv=\"refresh\" content=\"1;URL=reserv_status.php\">";
mysql_close($conn);
?>
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2014-03-06 23:14:41 |
By :
june_191 |
View :
655 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$str = "20-03-2557";
$olddate = explode("-",$str);
$newdate = $olddate[2]."-".$olddate[1]."-".$olddate[0]; // ค.ศ. ($olddate[2]-543)
ประยุกต์เอาครับ
|
 |
 |
 |
 |
Date :
2014-03-06 23:45:56 |
By :
ผู้มาเยือน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อ่ะ ผมเพิ่มเติมให้
$dateService=explode("-",$_REQUEST["dateService"]);
Code (PHP)
$sql="INSERT INTO reservroom(serviceID,subject,dateSave,dateService,timeIn,timeOut,userID,classID,departmentsID,branchID,amount,equipment,detail)";
$sql.="VALUES ('','$subject','$now','".$dateService[2]."-".$dateService[1]."-".$dateService[0]."','$timeIn','$timeOut','$ses_userID','$classID','$departmentsID','$branchID','$amount','$equipment
','$detail')";
|
 |
 |
 |
 |
Date :
2014-03-07 00:14:15 |
By :
tutordroid.com |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|