สอบถามเรื่องแปลงวันที่จาก databases หน่อยครับ

ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา สอบถามเรื่องแปลงวันที่จาก databases หน่อยครับ

สอบถามเรื่องแปลงวันที่จาก databases หน่อยครับ
พอดีผมลองทำจากใน localhost แล้วโยนขึ้น server แล้วมันกลับไม่โชว์ค่าอะไรออกมาเลยครับ ไม่ทราบว่าต้องแก้ตรงไหนครับผม

EX.index.php
<?php include ('config.php') ?>
<?php include ('changeDate.php') ?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<? 
$sql = "SELECT * FROM form_tb where cat_id=5";					
$result = mysql_query($sql,$c) or die("เอ็กซีคิวต์คำสั่ง  ไม่ได้");
$row =  mysql_num_rows($result);  
while ($arr = mysql_fetch_array($result)) { ?>

<span><?=$arr['date']?></span>
<br/>
<span><? $today=strtotime($arr['date']); print thai_date2($today); ?></span>
<br/>
<span><? $today=strtotime($arr['date']); print thai_date5($today); ?></span>
<br/><br/><br/>
<?php
} 
?>
<?php
$date = $_POST['date'];
$today=strtotime($date);
echo thai_date2($today);
?>
Ex.changedate.php
<?php
$thai_day_arr=array("อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์");
$thai_month_arr_full=array(
 "0"=>"",
 "1"=>"มกราคม",
 "2"=>"กุมภาพันธ์",
 "3"=>"มีนาคม",
 "4"=>"เมษายน",
 "5"=>"พฤษภาคม",
 "6"=>"มิถุนายน",
 "7"=>"กรกฎาคม",
 "8"=>"สิงหาคม",
 "9"=>"กันยายน",
 "10"=>"ตุลาคม",
 "11"=>"พฤศจิกายน",
 "12"=>"ธันวาคม"
);
$thai_month_arr=array(
 "0"=>"",
 "1"=>"ม.ค.",
 "2"=>"ก.พ.",
 "3"=>"มี.ค.",
 "4"=>"เม.ย.",
 "5"=>"พ.ค.",
 "6"=>"มิ.ย.",
 "7"=>"ก.ค.",
 "8"=>"ส.ค.",
 "9"=>"ก.ย.",
 "10"=>"ต.ค.",
 "11"=>"พ.ย.",
 "12"=>"ธ.ค."
);
function thai_date($time){
 global $thai_day_arr,$thai_month_arr;
 $thai_date_return = date("j",$time);
 $thai_date_return.= " ".$thai_month_arr[date("n",$time)];
 $thai_date_return.= " ".(date("Y",$time)+543);
 $thai_date_return.=    " ".date("H:i",$time)." น.";
 return $thai_date_return;
}
 
function thai_date2($time){
 global $thai_day_arr,$thai_month_arr;
 $thai_date_return = date("j",$time);
 $thai_date_return.= " ".$thai_month_arr[date("n",$time)];
 $thai_date_return.= " ".(date("Y",$time)+543);
 return $thai_date_return;
}
 
function thai_date3($time){
 global $thai_month_arr_full;
 $thai_date_return = " ".$thai_month_arr_full[date("n",$time)];
 $thai_date_return.= " ".(date("Y",$time)+543);
 return $thai_date_return;
}
 
function thai_date4($time){
 global $thai_day_arr,$thai_month_arr_full;
 $thai_date_return = date("j",$time);
 $thai_date_return.= " ".$thai_month_arr_full[date("n",$time)];
 $thai_date_return.= " ".(date("Y",$time)+543);
 return $thai_date_return;
}

function thai_date5($time){
 global $thai_day_arr,$thai_month_arr;
 $thai_date_return.=    " ".date("H:i",$time)." น.";
 return $thai_date_return;
}

?>


Yukungs 203.144.240.xxx 17-04-2014 10:36:45

คำแนะนำ และการใช้งาน

สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก


  • ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
  • เปลี่ยน


    ( หรือ เข้าใช้งานผ่าน Social Login )

 ความคิดเห็นที่ 1
คงต้องลองไล่ echo ค่าแต่ละค่าดู ว่าทีค่าจริงไหม เพราะดูจากโค้ดไม่น่าจะผิด


ninenik 115.67.134.xxx 17-04-2014
 ความคิดเห็นที่ 2
ขอบคุณครับ ตอนนี้ได้และ


yukungs 203.144.240.xxx 18-04-2014 11:58






เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ