thaiall logomy background
coding : vdo. createvdo.php.
my town
Source : Perl | PHP | ASP | JSP | HTML | HTML5 | JavaScript | Java | COBOL | C++ | MS Access | VBNet | VB | Python | โค้ดดี
File : createvdo.php. ID : 1903
Skin : Default | Sons-of-obsidian | Sunburst | Highlighter | Full
<?
require("connect.php");
echo "Delete existing database and all table : ";
$result=mysql_drop_db($db,$connect);
if ($result) { echo "Ok"; } else { echo "Error"; }
echo "<br>Create perlphpasp database for VDO system : ";
$result=mysql_create_db($db,$connect);
if ($result) { echo "Ok"; } else { echo "Error"; }
# =======
$tb = "vdo"; 
$query="create table vdo (vid char(13),flag char(1))";
$result=mysql_db_query($db,$query);
insertrec("2","t4400001m0001","B","",""); 
insertrec("2","t4400002m0001","A","","");
insertrec("2","t4400003m0001","B","","");
insertrec("2","t4400004m0001","F","","");
insertrec("2","t4400004c0001","B","","");
insertrec("2","t4400004c0002","A","","");
insertrec("2","t4400004c0003","B","","");
insertrec("2","t4400005m0101","B","","");
insertrec("2","t4400005m0201","B","","");
insertrec("2","t4400005m0301","B","","");
tocntrec();
$tb = "story"; 
$query="create table story (vid8 char(8),vname char(20))";
$result=mysql_db_query($db,$query);
insertrec("2","t4400001","Batman","","");
insertrec("2","t4400002","Superman","","");
insertrec("2","t4400003","Love Z","","");
insertrec("2","t4400004","Pokemon","","");
insertrec("2","t4400005","Doramon","","");
tocntrec();
$tb = "stock"; 
$query="create table stock (vid11 char(11),getdate date,amt int(3))";
$result=mysql_db_query($db,$query);
insertrec("3","t4400001m00","2000-11-06",1,"");
insertrec("3","t4400002m00","2000-11-31",1,"");
insertrec("3","t4400003m00","2001-06-06",1,"");
insertrec("3","t4400004m00","2001-06-06",1,"");
insertrec("3","t4400004c00","2001-06-06",3,"");
insertrec("3","t4400005m01","2001-06-06",1,"");
insertrec("3","t4400005m02","2001-06-06",1,"");
insertrec("3","t4400005m03","2001-06-06",1,"");
tocntrec();
$tb = "borrow"; 
$query="create table borrow (bid char(11),bdate date,cid char(7),eid char(5))";
$result=mysql_db_query($db,$query);
insertrec("4","r4400000151","2001-11-28","c440001","e4401");
insertrec("4","r4400000152","2001-12-21","c440001","e4401");
insertrec("4","r4400000153","2001-12-22","c440002","e4402");
tocntrec();
$tb = "borrowd"; 
$query="create table borrowd (bid char(11),vid char(13),bflag char(1),sdate date)";
$result=mysql_db_query($db,$query);
insertrec("4","r4400000151","t4400004c0001","S","2001-12-1");
insertrec("4","r4400000151","t4400004c0002","S","2001-11-30");
insertrec("4","r4400000152","t4400001m0001","B","2001-12-28");
insertrec("4","r4400000152","t4400004c0001","F","2001-12-25");
insertrec("4","r4400000152","t4400004c0002","S","2001-12-26");
insertrec("4","r4400000152","t4400004c0003","S","2001-12-25");
insertrec("4","r4400000153","t4400005m0301","S","2001-12-26");
tocntrec();
$tb = "empl"; 
$query="create table empl (eid char(5),ename char(20),cryptpasswd char(13))";
$result=mysql_db_query($db,$query);
$pass = "abc";
$key = "thaiall";
$cryptpasswd = crypt($pass,$key);
insertrec("3c","e4401","Mr.Tatsanee","$cryptpasswd","");
insertrec("3c","e4402","Mr.Suwit","$cryptpasswd","");
tocntrec();
$tb = "cust"; 
$query="create table cust (cid char(7),cname char(20),addr char(40))";
$result=mysql_db_query($db,$query);
insertrec("3c","c440001","Ms.Pong","Yonok college lampang 52000","");
insertrec("3c","c440002","Ms.Ketsarin","Yonok college lampang 52000","");
insertrec("3c","c440003","Ms.Phimine","146 T.Sala A.Korkar Lampang 52130","");
tocntrec();
mysql_close($connect);
# == end ==
function insertrec($cntx,$x1,$x2,$x3,$x4) {
  global $db,$tb;
  if ($cntx=="2"){$query="insert into $tb values('$x1','$x2')";}
  if ($cntx=="3"){$query="insert into $tb values('$x1','$x2',$x3)";}
  if ($cntx=="3c"){$query="insert into $tb values('$x1','$x2','$x3')";}
  if ($cntx=="4"){$query="insert into $tb values('$x1','$x2','$x3','$x4')";}  
  $result = mysql_db_query($db,$query);  
  if ($result) { echo "<br>$query : Ok"; } else { echo "<br>$query : Error"; }   
}
function tocntrec(){
  global $db,$tb;
  $result = mysql_db_query($db,"select * from $tb");
  $cnt=mysql_num_rows($result);
  echo "<br>Total record : $cnt <hr>";
}
?>
จำนวน : 96 บรรทัด
าษาเฮชทีเอ็มแอล (HTML = HyperText Markup Language) คือ ภาษาคอมพิวเตอร์ที่ออกแบบมาเพื่อใช้ในการสร้างเว็บเพจที่เรียกดูผ่านทางเว็บเบราว์เซอร์ (Web Browser) เริ่มพัฒนาโดย ทิม เบอร์เนอรส์ ลี (Tim Berners Lee) ในปัจจุบัน HTML ล่าสุดคือ รุ่น 5 เป็นมาตรฐานหนึ่งของ ISO ซึ่งจัดการโดย World Wide Web Consortium (W3C) ในปัจจุบัน ทาง W3C ผลักดัน รูปแบบของ HTML แบบใหม่ ที่เรียกว่า XHTML รุ่นแรกคือ 1.0 (ม.ค.2543) ซึ่งมีโครงสร้างเป็นแบบ XML (eXtensible Markup Language)
าษาพีเอชพี (PHP Language) คือ ภาษาคอมพิวเตอร์ประเภทโอเพนท์ซอร์ท (Open Source Computer Language) สำหรับพัฒนาเว็บเพจแบบไดนามิก เมื่อเครื่องบริการได้รับคำร้องจากผู้ใช้ก็จะส่งให้กับ ตัวแปลภาษา ทำหน้าที่ประมวลผลและส่งข้อมูลกลับไปยังเครื่องของผู้ใช้ที่ร้องขอ ในรูปเอชทีเอ็มแอล ภาพ หรือแฟ้มดิจิทอลอื่นใด ลักษณะของภาษามีรากฐานคำสั่งมาจากภาษาซี เป็นภาษาที่สามารถพัฒนาให้ใช้งานแบบโต้ตอบกับผู้ใช้ได้
าษาไพทอน (Python Language) คือ ภาษาคอมพิวเตอร์ประเภทโอเพนท์ซอร์ท (Open Source Computer Language) สำหรับพัฒนาแอพพลิเคชั่นโดยไม่ยึดติดกับแพลตฟอร์ม (Platform) และใช้ในงานได้หลายประเภท ทั้งใช้ในการประมวลผลผ่านคอมมานด์ไลน์ หรือเป็นเว็บเพจแบบไดนามิก เมื่อเครื่องบริการได้รับคำร้องจากผู้ใช้ก็จะส่งให้โค้ดให้กับตัวแปลภาษา เพื่อทำหน้าที่ประมวลผลและส่งข้อมูลกลับไปยังเครื่องของผู้ใช้ที่ร้องขอ ในรูปข้อความ เอชทีเอ็มแอล ภาพ หรือแฟ้มดิจิทอลอื่นใด ลักษณะของภาษามีรากฐานคำสั่งมาจากภาษาซี เป็นภาษาที่สามารถพัฒนาให้ใช้งานแบบโต้ตอบกับผู้ใช้ได้ จุดที่แตกต่างกับภาษาอื่น คือ การรวบรวมจุดเด่นของแต่ละภาษามารวมเข้าด้วยกัน
อสคิวแอล (SQL = Structured Query Language) คือ ภาษาสอบถามข้อมูล หรือภาษาจัดการข้อมูลอย่างมีโครงสร้าง มีการพัฒนาภาษาคอมพิวเตอร์ และโปรแกรมฐานข้อมูลที่รองรับมากมาย เพราะจัดการข้อมูลได้ง่าย เช่น MySQL, MariaDB, MsSQL, PostgreSQL หรือ MS Access เป็นต้น สำหรับโปรแกรมฐานข้อมูลที่ได้รับความนิยมคือ MySQL หรือ MariaDB เป็น Open Source ที่ใช้งานได้ทั้งใน Linux และ Windows
ตัวอย่าง Hello World
ปรับปรุงโปรแกรม source.pl : 2565-07-24
rspsocial
Thaiall.com