php簡單資料庫練習

2021-08-19 22:43:18 字數 1170 閱讀 8451

<?php include('myfunction.php');

consolelog("include test");

//接收使用者提交資料,並儲存到資料庫中

if($_post)elseelse

}}else

}}else

// //登陸頁面時,從資料庫讀取

// //連線資料庫操作

// $servername="localhost";

// $username="root";

// $passowrd="root";

// //建立連線

// $conn=new mysqli($servername,$username,$passowrd);

// //檢測連線

// if($conn->connect_error)else

//建立乙個物件

class person

function setfirstname($firstname)

function setlastname($lastname)

function setemail($email)

function getfirstname()

function getlastname()

function getemail()

}?>

firstname

lastname

email

<?php 

$servername = "localhost";

$username = "root";

$password = "root";

$dbname = "db_test";

// 建立連線

$conn = new mysqli($servername, $username, $password, $dbname);

// check connection

if ($conn->connect_error)  

$sql = "select * from db_person";

$result = $conn->query($sql);

if ($result->num_rows > 0)

} else

$conn->close();

?>

新增使用者

簡單資料庫程式設計

1 修改配置檔案 web.config 2 建立鏈結類 connection.cs using system.data.sqlclient 新增名字空間 public static sqlconnection getconnection return new sqlconnection system...

SQLite簡單資料庫

通過觀察可以發現,不管是聊天列表還是 列表,有乙個共性 資料量大和資料結構複雜 那麼為什麼我們要用sqlite,有這麼幾個原因 sqlite常用的幾種資料型別為text文字型,integer整型,real浮點型,建 式要用規定的格式,如下 create table product 建立資料庫和資料表...

php簡單資料庫操作類的封裝

一 public function connect else mysql select db this db,this connid or die connect db false mysql query set names this code return this connid 返回資料庫連線物...