Copy code The code is as follows:
require_once("mssql.class.php");
//1. Create a class and connect to the database
$db = new mssql("dns=aaa;uid=sa;pwd=sa;dbname=test");
//2. Connect to the database
$conn = $db->config("dns=aaa;uid=sa;pwd=sa;dbname=test");
///3. Select database
$dbname = $db->select_db ("test");
//4. Set to allow debugging
$db->debug = true;
//5. Execute a SQL statement that does not return a result
$db-> ;execute("insert into test01(name) values('This is a test!')");
//$db->exec("");
//6. Execute a return result SQL statement
$rs = $db->query("select * from test01");
///7. Display the results in row format
echo "
Display the results in row format set
";
while($r = $db->fetch_row($rs)){
echo $r[0].":".$r[1]."< br>";
}
//8. Display the results in array format
$rs2 = $db->query("select * from test01");
echo "
Display the result set in array format
";
while($r = $db->fetch_array($rs2)){
echo $r["id"] . ":" . $r["name"] . "
";
}
//X. Release
$db->db_close();
?>
http://www.bkjia.com/PHPjc/325665.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/325665.htmlTechArticleCopy the code as follows: ?PHP require_once("mssql.class.php"); //1. Create a class , and connect to the database $db = new mssql("dns=aaa;uid=sa;pwd=sa;dbname=test"); //2. Connect to the database $conn =...