1.Select 查詢語句 佔位方式一
//sql 查詢語句 佔位方式一
$sql = "select * from tp_articles where id =?";
$result = Db::query($sql,[104]);
dump($result);
Select 查詢語句 佔位方式二
//sql 查詢語句 佔位方式二
$sql = "select * from tp_articles where id =:id";
$result = Db::query($sql,["id" => 103]);
dump($result);
2.insert 插入語句
//插入語句
$sql = "insert into tp_articles(title,desn,body) values(:title,:desn,:body)";
$result = Db::execute($sql,['title' => '我是標題111', 'desn' => '我是描述','body'=>'aaaaaa']);
dump($result);
3.修改語句
//修改語句
$sql = "update tp_articles set title=:title where id=:id";
$ret = Db::execute($sql,["title" => "我是隊長啊威啊","id" => 220]);
dump($ret);
4.刪除語句
//刪除語句
$sql = "delete from tp_articles where id=:id";
$ret = Db::execute($sql,["id" => 220]);
dump($ret);