function Conn2DBS()
{
global $conn;
global $ServerName;
global $UserName;
global $UserPassword;
global $DataBaseName;
$conn = mysql_connect( $ServerName, $UserName, $UserPassword );
if ( ! $conn )
die( "ไม่สามารถติดต่อกับ MySQL ได้" );
mysql_select_db( $DataBaseName, $conn )
or die ( "ไม่สามารถเลือกใช้งานฐานข้อมูลได้" );
}
function CloseDBS()
{
global $conn;
mysql_close( $conn );
}
function CodeSname( $CodeSname )
{
global $conn;
$strSQL = "INSERT INTO tbl_sname ( sname ) ";
$strSQL = $strSQL . "VALUES ( '$CodeSname' )";
mysql_query( $strSQL, $conn )
or die ( "INSERT มีข้อผิดพลาดเกิดขึ้น") . mysql_error();
}
//ต่ออีกหน่อย ถอด decode
function DecodeSname( $id_sname )
{
global $conn;
$strSQL= mysql_query( "SELECT sname FROM tbl_sname WHERE id_sname=$id_sname" );
$rs = mysql_fetch_array ( $strSQL );