Friday, October 3, 2014

สร้างกรอบรูปโดยใช้ HTML (Image Border By HTML)

<img src="image.png" width="100" height="10" border="0" alt="" style="border: 1px solid #ccc; padding: 5px;">

เปลี่ยนรูปให้โปร่งใสเมื่อวางเมาส์บนรูป (Opacity Image on Mouseover)

<img src="yourimage.png" width="100" height="10" border="0" alt="" style="opacity:0.5;filter:alpha(opacity=50)" onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100" onmouseout="this.style.opacity=0.5;this.filters.alpha.opacity=50">

ฟังก์ชั่น หาค่าไอพี โดยใช้ PHP (Get IP Address By PHP)

<?
function getIP(){
if ($_SERVER['HTTP_CLIENT_IP']) { 
$IP = $_SERVER['HTTP_CLIENT_IP'];
} elseif (ereg("[0-9]",$_SERVER["HTTP_X_FORWARDED_FOR"] )) { 
$IP = $_SERVER["HTTP_X_FORWARDED_FOR"];
} else { 
$IP = $_SERVER["REMOTE_ADDR"];
}
return $IP;
}

echo "Your IP is".getIP();
?>

การลบวันที่สองวันโดยใช้ PHP DateDiff (Date Difference By PHP)

<?
function DateDiff($strDate1,$strDate2)
{
return (strtotime($strDate2) - strtotime($strDate1))/ ( 60 * 60 * 24 ); // 1 day = 60*60*24
}

echo DateDiff("2014-10-01","2014-10-05");
?>


การใช้ CSS สร้างตารางโค้ง (CSS CURV Table)

#td{
color: black;
border: 1px solid #FEDDFE;
-webkit-border-radius: 1px;
}

ฟังก์ชั่น PHP ตรวจสอบคำภาษาไทย(PHP Check Thai Word)

<?
function checkthai($word){
return preg_replace('/[^ก-๙]/u','',$word);
}
$checkthaiword=trim(checkthai('บันทึกข้อความ!!'));

if($checkthaiword != ""){ echo "มีภาษาไทย"; }

?>

คำสั่งแทนที่ Mysql (MySQL Replace Word)

UPDATE TableName SET FieldName = REPLACE( FieldName ,'search word','replace word')