|
|
|
ช่วยด้วยครับ query ออกมา ไม่เป็นภาษาไทยซักที รบกวนด้วยนะครับ |
|
|
|
|
|
|
|
Code (PHP)
<?
class Connection
{
var $host="localhost";
var $user="root";
var $pass="root";
var $database="cinema";
function Conect()
{
$con = mysql_connect($this->host,$this->user,$this->pass);
mysql_select_db($this->database);
mysql_db_query($this->database,"SET character_set_connection=utf8");
if ($con or mysql_select_db($this->database) AND die("Can't connect to database name $this->database"))
{
return true;
}
else
{
return false;
}
}
//SELECT
function Select($table)
{
$this->Conect();
$cmd = "Select * From $table";
return mysql_db_query($this->database,$cmd);
}
//INSERT
function Insert($table,$column,$values)
{
$this->Conect();
$cmd = "insert into $table ($column) values ($values)";
mysql_db_query($this->database,$cmd) or die ("Can't Add new record ");
}
//DELETE
function Deleter($table,$value)
{
$this->Conect();
$cmd ="delete from $table where $value";
mysql_db_query($this->database,$cmd);
}
//UPDATE
function Update($table,$change,$condition)
{
$this->Conect();
$cmd ="UPDATE $table SET $change WHERE $condition";
mysql_db_query($this->database,$cmd) or die ("Can't Add new record ");
}
//ROW COUNT
function Row_Count($value)
{
return mysql_num_rows($value);
}
//???? 00 ???? ???????????????? ???????? ?????????
function len($value)
{
if(strlen($value)==1)
{
return "00".$value;
}
else if(strlen($value)==2)
{
return "0".$value;
}
else
{
return $value;
}
}
function len2($value,$count) //????????????????????
{
for($i=0;strlen($value)<=$count;$i++ )
{
$value = "0".$value;
}
return $value;
}
function id_count($name,$count)
{
$count_member = $this->Select("$name");
$count_member = $this->Row_Count($count_member);
$count_member++;
$count_member = $this->len2($count_member,$count);
return $count_member;
}
function DateDiff($strDate1,$strDate2) // ระยะห่างวันเวลา
{
return (strtotime($strDate2) - strtotime($strDate1))/ ( 60 * 60 * 24 ); // 1 day = 60*60*24
}
function sms($text,$Sname)
{
$Username = "[email protected]";
$Password = "312310";
$Text = "$text";
$PhoneNumber = "0841002830";
$SMSMode = "T";
$SName = "$Sname";
$message = urlencode($Text);
// $message = $Text;
$data = "EmailAddress=" . $Username . "&PWD=" . $Password . "&Text=" . $message . "&Phone=" . $PhoneNumber.
"&SMode=" . $SMSMode . "&Sender=" . $SName;
$ch = curl_init('http://www.diy-sms.com/sms/DIY_SMS_API.ASP');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);//This is the result from diy-sms
curl_close($ch);
return $result;
}
function smsstatus()
{
$Username = "[email protected]";
$Password = "312310";
$data = "EmailAddress=" . $Username . "&PWD=" . $Password;
$ch = curl_init('http://www.diy-sms.com/sms/DIY_SMS_API_CR.ASP');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
return $result;
curl_close($ch);
}
function to_utf16($text)
{
$out="";
$text=mb_convert_encoding($text,'UTF-16','UTF-8');
for ($i=0;$i<mb_strlen($text,'UTF-16');$i++)
$out.= bin2hex(mb_substr($text,$i,1,'UTF-16'));
return strtoupper($out);
}
}
?>
Tag : PHP
|
|
|
|
|
|
Date :
2013-08-17 19:20:52 |
By :
lungzee |
View :
819 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณครับ
|
|
|
|
|
Date :
2013-08-18 00:40:54 |
By :
lungzee |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|