--- title: PHP5 -SQL-join+VS CODE 開始 tags: PHP --- ![](https://i.imgur.com/FMf5TRQ.png) ![](https://i.imgur.com/G1Volqn.png) 多對1 ![](https://i.imgur.com/ROkU6dH.png) 3是社團流水號 ![](https://i.imgur.com/ZZZ1rQK.png) ![](https://i.imgur.com/M5ZIu2H.png) 把兩個資料表結合再一起 ![](https://i.imgur.com/r86wvNs.png) 在資料庫 才有東西可以選 ![](https://i.imgur.com/V0jVAdX.png) 只能自己打 不能用選的 ```` SELECT 學生資料.*,`社團清單`.* FROM 學生資料 INNER JOIN 社團清單 ON 學生資料.`參與社團` = 社團清單.`社團流水號`; ```` ![](https://i.imgur.com/5thyNS4.png) ```` SELECT `學生資料`.*,`社團清單`.* FROM 學生資料 INNER JOIN 社團清單 ON `學生資料`.`參與社團` = `社團清單`.`社團流水號`; ```` ![](https://i.imgur.com/1VPET1f.png) ![](https://i.imgur.com/cTIIueP.png) --- ```` ELECT 學生資料.*,`社團清單`.* FROM 學生資料 , 社團清單 WHERE 學生資料.`參與社團` = 社團清單.`社團流水號` ```` ![](https://i.imgur.com/MvlWItY.png) ![](https://i.imgur.com/OvCPBBf.png) RIGHT JOIN 以右邊的資料表為主 --- 以左邊的資料表為主 ```` SELECT 學生資料.*,`社團清單`.* FROM 學生資料 LEFT JOIN 社團清單 ON 學生資料.`參與社團` = 社團清單.`社團流水號` ```` ![](https://i.imgur.com/3YMJpbm.png) ![](https://i.imgur.com/8S2ZQwJ.png) --- 新增 INSERT INTO ![](https://i.imgur.com/mcEA4RQ.png) 按下面的INSERT 就會顯示 預設值=流水號 可以不用寫 ![](https://i.imgur.com/uHfhYI9.png) ```` INSERT INTO 學生資料`(學生姓名, 學生性別, 參與社團) VALUES ('廖小和','男',2) ```` ![](https://i.imgur.com/O3BlECm.png) ![](https://i.imgur.com/wHfAXNx.png) --- 一次增加兩筆 ```` INSERT INTO `學生資料`(學生姓名, 學生性別, 參與社團) VALUES ('廖小和','男',2),('黃小白','女',3) ```` ![](https://i.imgur.com/KzI69iS.png) ![](https://i.imgur.com/BEJNr7c.png) --- UPDATE - 預設寫法.更新 就更新 不能 回頭 ![](https://i.imgur.com/Xhb1QnW.png) ![](https://i.imgur.com/KBgtJIT.png) ![](https://i.imgur.com/R0Mz5rJ.png) --- 資料庫結束- 開始 PHP ![](https://i.imgur.com/wmpERqn.png) 使用VS CODE ![](https://i.imgur.com/HqBkoXs.png) ![](https://i.imgur.com/cgG0oRX.png) 最後一個延伸模組 =外掛 很常用到 ![](https://i.imgur.com/DfD61ch.png) ![](https://i.imgur.com/snwgNbU.png) Auto Rename Tag Bracket Pair Colorizer-這個要1 ![](https://i.imgur.com/xUex0hK.png) CSS Peek HTML CSS Support ![](https://i.imgur.com/hHiTZaT.png) IntelliSense for CSS class names in HTML ![](https://i.imgur.com/xXFpzBp.png) PHP Intelephense -終於裝到 這隻大象了 ![](https://i.imgur.com/hajwPXj.png) --- HTML語法規則 em -斜線 hr -水平線 開網頁- ![](https://i.imgur.com/rCaozYo.png) ![](https://i.imgur.com/nEAHO8T.png) 存檔類型- 要選存HTML ![](https://i.imgur.com/iYy4T2P.png) 網頁的速寫模式 ![](https://i.imgur.com/3kVdzLB.png) 打html + 按 Tab 就會全部跑出來 也可以按 ! + 按 Tab 就會全部跑出來 ![](https://i.imgur.com/vjttqvg.png) 檔案-喜好設定-設定-字的大小 ![](https://i.imgur.com/lFr4htF.png) ```` <!DOCTYPE html> //宣告html的版本 現在是版本5 <html lang="en"> // 網頁預設是英文語系 <head>//檔頭資訊 <meta charset="UTF-8">//檔頭語系 <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title>//網頁標題 </head> <body>//內文資訊 </body> </html> ```` ![](https://i.imgur.com/98MZvSL.png) ![](https://i.imgur.com/Ho5OaY4.png) 打開沒東西 ![](https://i.imgur.com/VLWKvyD.png) 內文寫 123 ![](https://i.imgur.com/ppMCJ08.png) 按F5 自動更新 ![](https://i.imgur.com/gvktusc.png) em -斜線 ```` <body> 123 <hr> <em>123</em> </body> ```` hr -水平線 ![](https://i.imgur.com/T0Eb88L.png) ![](https://i.imgur.com/6HGNKmj.png) 把剛剛的網頁檔貼到這裡 C:\xampp\htdocs ![](https://i.imgur.com/p5f0KTB.png) 檔名要改 php 才可以放 開新的資料夾-C:\xampp\htdocs\myphp ![](https://i.imgur.com/synUT9u.png) ![](https://i.imgur.com/Uzstrfg.png) 開啟資料夾-直接點此資料夾 ![](https://i.imgur.com/pXYxH6x.png) ![](https://i.imgur.com/Zu8rw0M.png) http://localhost:8012/myphp/ ![](https://i.imgur.com/1xm5r39.png) ![](https://i.imgur.com/aOcAt9y.png) ![](https://i.imgur.com/H8aKJbh.png) 寫在BODY 裡面- ![](https://i.imgur.com/lCb66Kp.png) --- ![](https://i.imgur.com/XKhTIU4.png) 點程式名稱- http://localhost:8012/myphp/0312-01.php ![](https://i.imgur.com/79E6ZkV.png) --- 註解: CTRL+C --- 變數是以 $ 符號為 開始 - 大小寫有別 不可以數字開始 要記得有分號 ```` <body> <?php $myhello ="HELLO"; echo $myhello; ?> </body> ```` ![](https://i.imgur.com/HHYKE3J.png) ![](https://i.imgur.com/EicNn2o.png) --- 要 " " 才算是變數 然後 單引號 雙引號 表示 也不同 ![](https://i.imgur.com/Jv4FDUZ.png) --- 時間變數 ```` date_default_timezone_set("Asia/Taipei"); echo date("Y-m-d H:i:s"); ```` ![](https://i.imgur.com/npS3K11.png) ![](https://i.imgur.com/ave6V6l.png) --- ![](https://i.imgur.com/YMTB7eS.png) . 點 可以連接 變數 ![](https://i.imgur.com/ajJuaFM.png) ```` <body> <?php $aa = "我想學會"; $bb = "PHP"; $cc = $aa.$bb; echo $cc ; ?> </body> ```` ![](https://i.imgur.com/i870CuC.png) --- ++ 跟 --寫在後面有特例 ![](https://i.imgur.com/r2OeQdK.png) ---