施勢帆老師的教學網站

 找回密碼
 立即註冊
搜索
熱搜: 活動 交友 discuz
查看: 725|回復: 0

Work #14 TinyDB & Web Databases

[複製鏈接]

609

主題

619

帖子

2898

積分

管理員

Rank: 9Rank: 9Rank: 9

積分
2898
發表於 2023-11-6 15:15:47 | 顯示全部樓層 |閱讀模式
http://appinventor.mit.edu/explore/ai2/custom-tinywebdb.html

https://mouse.ee.aeust.edu.tw/Data/AI2/Demo/ch13/ch13_2%20%A4U%B8%FC%A4%CE%A6w%B8%CBTinyWebDB%AC%DB%C3%F6%AA%BA%B3n%C5%E9/

https://www.python.org/downloads/

https://cloud.google.com/appengine/downloads?hl=zh-TW

https://appengine.google.com/

http://ai2.appinventor.mit.edu/r ... customtinywebdb.zip

作業 :
將學號和姓名的輸入和輸出結果放置 Mysql , 並可顯示.需有Listpicker

http://Your_IP/db_insert.php?ID=123456789&Name=Shie

<?php
header("Content-Type:text/html;charset=utf-8");
$db=mysql_connect("localhost","root","123456");
mysql_select_db("test");
if (!$db)
{
    die("connect error" . mysql_connect_error());
}
else
{
    echo "Success!";
}
mysql_query("set names 'utf8'");

$ID = $_GET['ID'];
$Name = $_GET['Name'];
$query = "INSERT INTO `practice`(`ID`, `Name`) VALUES ($ID, '$Name');";
$result = mysql_query($query) or trigger_error("Query MySQL Error;".mysql_error($db));
mysql_close($db);
?>




<?php
header("Content-Type:text/html;charset=utf-8");
$db=mysql_connect("localhost","root","123456");
mysql_select_db("test");
if (!$db)
{
    die("connect error" . mysql_connect_error());
}
mysql_query("set names 'utf8'");

$ID = $_GET['ID'];
$query = "SELECT * FROM  `practice` where ID=$ID;";
$result = mysql_query($query) or trigger_error("Query MySQL Error;".mysql_error($db));
while ($row = mysql_fetch_assoc($result)) {
    echo $row['ID'];
    echo "     ";
    echo $row['Name'];
}

mysql_close($db);
?>



<?php

header("Content-Type:text/html;charset=utf-8");

$db=mysql_connect("localhost","root","123456");
mysql_select_db("test");

if (!$db)
{
    die("connect error" . mysql_connect_error());
}

mysql_query("set names 'utf8'");

$ID = $_GET['ID'];

$query = "DELETE FROM  `practice` where ID=$ID;";

echo "<br><br>".$query."<br>";

$result = mysql_query($query) or trigger_error("Query MySQL Error;".mysql_error($db));

mysql_close($db);

?>



https://mouse.ee.aeust.edu.tw/fo ... =215&extra=page%3D1


回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則

Archiver|手機版|小黑屋|施勢帆老師的教學網站

GMT+8, 2024-11-24 22:36 , Processed in 0.034549 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回復 返回頂部 返回列表