mamu wuu
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # DB Term Project Proposal Team9 + 20200424 會議記錄 + 用google meet通話討論 + 找尋適合的資料(資料較完整的) + 討論project初步主題:勞工就業時狀況 + 與使用者輸入互動的展示 + 完成初步的proposal + 20200601 會議記錄 + 用google meet通話討論 + 更改主題,因發現原資料數太少→醫療資料查詢 + 準備presentation + 20200707 會議記錄 + 用google meet通話討論 + 研究PHP使用方式與安裝XAMPP + 上傳好presentation的ppt + 20200708 + 雛形:只有三個選項的網站: + by SQLite & phpMyAdmin + ![name=Guest Sparks](https://imgur.com/J5Lej1Z.png) + csv用記事本轉檔後變data2.txt(ANSI => utf-8) + 設定by terminal: ![](https://imgur.com/Ir39W14.png) + 20200709 會議記錄 + 用line通話討論,因為google meet的回音消不掉所以改用line + 安裝SQLite、約好明天出去討論的時間和地點 + 確定functionality使否有缺漏(spec需求) + 分工 + 彥慈:後台程式碼 + 佳真:資料連接、處理google find place api、google place nearby api等 + 思函:網路介面(使用者輸入的框框、列表拉軸)、會議記錄 + 靖雅:表格整理(修正資料是否正確或缺漏)、Report + 20200710 + 進度確認:將分工的code合在一起 + 初步完成delete、insert、update、dbconnect部分 + 20200712 + Report完成一部分 + 初步完成各種search、介面部分 + 20200713 + 補充Report資訊 + 將code部分完善好 + 20200714 + 完成Report + 完成demo影片 + 將Report和影片交上去且在github傳上code <!-- + note(下載完成後) + ![](https://i.imgur.com/GTzdpC7.png) + ![](https://i.imgur.com/N48LZuM.png) + ![](https://i.imgur.com/Y4tgpAs.png) ![](https://i.imgur.com/PmG0fb5.png) --> + 20200710初步成果 + google place search拿到xml資料 + ![](https://i.imgur.com/WsQzD1X.png) <!-- :::success ![](https://i.imgur.com/fEnXy7m.png) ![](https://i.imgur.com/G3qe2eb.png) ::: --> + 針對report問題 ![](https://i.imgur.com/qGe6LHA.png) ![](https://i.imgur.com/4RdmLtM.png) :::info # 參考資料 + **使用 VS Code + XAMPP 進行 PHP 的開發與Debug** https://dotblogs.com.tw/ianchiu28/2017/06/15/180900?fbclid=IwAR2hIofg9S8t233qAS5rV3YWxvlzjBf11KO83MTLjNAA0oU9dPNeDlLrCvc + **PHP Tutorials** https://www.youtube.com/watch?v=qVU3V0A05k8&list=PL0eyrZgxdwhwBToawjm9faF1ixePexft- + **MySQLi Tutorial** https://www.tutorialspoint.com/mysqli/mysqli_update_query.htm ::: :::warning # phpmyadmin教學 + 下載xampp(放到d槽) + 打開xampp-control.exe + ![](https://i.imgur.com/j3ZaiLd.png) + Apache MySQL打開start + ![](https://i.imgur.com/mmOS0fM.png) + 如果MySQL打開失敗 + 3306端口被占用了。因为之前用過MySQL。所以要把它關掉。命令提示窗口(Window下为:win键+R)输入services.msc即可。 + ![](https://i.imgur.com/P4MWMOp.png) + ![](https://i.imgur.com/xg5VZe3.png) + 資料來源: https://blog.csdn.net/code_while/article/details/79586330?fbclid=IwAR1JJSSi2UwH69r-rZ-9BYvwlz3CPmhBAF44jNcad6h1dcLMtsfm-pD2pz4 + 去網址打 http://localhost/phpmyadmin/ + ![](https://i.imgur.com/mVU4nUq.png) + 去網址打 http://localhost/ + 可以看到htdocs的檔案 + code包成一個資料夾放這裡 + ![](https://i.imgur.com/iZAWh82.png) + ![](https://i.imgur.com/sAWJaRd.png) + 匯入table + 可以直接新增一個database 然後右上方欄匯入csv + csv記得先以記事本模式開啟另存新檔 ANSI -> UTF-8 + ![](https://i.imgur.com/brrkoH6.png) + 在網址列 http://localhost/database_final_project/ 進入主畫面 + ![](https://i.imgur.com/qJmO5sS.png) ::: :::success # database資料 ### table1 ![](https://i.imgur.com/MAyWUrj.png) ### table2 ![](https://i.imgur.com/Gq75r1f.png) ::: :::success # Report Database <!-- 1. What database do you use (MySQL, SQLite, etc.) 2. How do you maintain your database (update data, add new data etc.) 3. Describe how you connect your database to your application as detail as possible 3-1. use text, graphs, tables, etc. make your explaination clear and complete 3-2. how your backend process queries from application? do you do exception handling? what if someone do something unexpected? --> ### db_connect.php + in order to access database directly from our web we need to **build a connection with our database using PHP** + ![](https://i.imgur.com/WGBtnY8.png) ### style.css + 一些css block的設定 ### header.php + 所有header的資料其他檔案可以方便直接include + 連接style.css db_connect. php + ![](https://i.imgur.com/ZPgQraH.png) ### index.php + 主要的homepage + 依序分別為下拉式區域診療科別、資料新增插入區、以及條件式搜尋醫療機構 ### search_bar.php + 下拉式區域診療科別接受input後進入的結果呈現頁面 + ![](https://i.imgur.com/XIBCJRV.png) + 表格式呈現結果 + ![](https://i.imgur.com/McffN0z.png) + 接受input的時候都有用 mysqli_real_escape_string() + escapes special characters in a string for use in an SQL query, taking into account the current character set of the connection. + This function is used to create a legal SQL string that can be used in an SQL statement. + 转义在 SQL 语句中使用的字符串中的特殊字符。 + ![](https://i.imgur.com/AiV0jWk.png) + 並且對sql使用Prepared Statements + execute the same (or similar) SQL statements repeatedly with high efficiency. + Prepared statements reduce parsing time as the preparation on the query is done only once (although the statement is executed multiple times) + Bound parameters minimize bandwidth to the server as you need send only the parameters each time, and not the whole query + Prepared statements are very useful against SQL injections, because parameter values, which are transmitted later using a different protocol, need not be correctly escaped. If the original statement template is not derived from external input, SQL injection cannot occur. + ![](https://i.imgur.com/O9hNapy.png) ### search_direct.php + 條件式搜尋醫療機構接受input後進入的結果呈現頁面 + ![](https://i.imgur.com/KQPlpGC.png) + 提供兩種搜尋 + 一種是針對已知機構名稱查詢詳細資料 + ![](https://i.imgur.com/SLHLt7g.png) + mysqli_real_escape_string() Prepared Statements的使用同上 + 另一種是針對指定地點限定距離內搜尋所有醫療機構資訊 + ![](https://i.imgur.com/9Ab6qgs.png) + mysqli_real_escape_string() Prepared Statements的使用同上 + 對input資料先用google find place api取得其經緯度資料 + 再使用google place nearby api對條件做搜尋 + 醫療機購 type=doctor,hospital,physiotherapist,dentist + 限定目前營業中 opennow=true ### insert.php + 資料新增插入區在homepage提供資料插入也另外自己有一個頁面 + ![](https://i.imgur.com/kOy1qpj.png) + 限定使用者必須所有資料都填齊並且會偵測是否有duplicate key + 由於我們有設定機構代碼為primary key所以會自動報錯 + 執行insert query![](https://imgur.com/Mnz6yng.png) 利用mysqli_stmt_bind_param函式 bind variables for the parameter markers in the SQL $stmt that was passed to mysqli_prepare().![](https://imgur.com/b7fTMkd.png) ### list.php + 以表格式陳列資料庫所有醫療機構資料 + 在list的介面提供使用者做兩種操作分別為edit delete + ![](https://i.imgur.com/lD17NLf.png) ### update.php + 針對使用者在list頁面按下edit後跳往的頁面 + ![](https://i.imgur.com/iPmMZXB.png) + assign $ HOST_NAME, $ADDR, $TEL from $_POST [] + $ _POST[]得到的資料如前述以mysqli_real_escape_string()處理 + assign $ HOST變數 =$row_get[] + (沒收到 $ _POST時 下query取得原資料,存於$row_get) + ![](https://imgur.com/7cxHDTQ.png) + 執行update query ![](https://imgur.com/XKFJGt1.png) ### delete.php + 針對使用者在list頁面按下delete "確認"後跳往的頁面 + ![](https://i.imgur.com/9lPwVZy.png) + ![](https://i.imgur.com/kIVgrXf.png) + 以機構代碼為key,執行delete query ![](https://i.imgur.com/PTa3VTw.png) ::: ###### tags: `database`

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully