本文整理汇总了PHP中sqlsrv_close函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlsrv_close函数的具体用法?PHP sqlsrv_close怎么用?PHP sqlsrv_close使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sqlsrv_close函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Query
public function Query($Procedimiento, $RetornaDatos, $arrayValores = "")
{
$parametros = array();
$NombreServidor = constant("sqlHost");
$InfoConexion = array("UID" => constant("sqlUsuario"), "PWD" => constant("sqlContrasena"), "Database" => $this->NombreBaseDatos);
$conn = sqlsrv_connect($NombreServidor, $InfoConexion);
if (is_array($arrayValores)) {
$stringInterrogacion = "(?";
for ($i = 1; $i < count($arrayValores); $i++) {
$stringInterrogacion .= ",?";
}
$stringInterrogacion .= ")";
$Procedimiento = "{call " . $Procedimiento . " " . $stringInterrogacion . "}";
for ($i = 0; $i < count($arrayValores); $i++) {
array_push($parametros, array($arrayValores[$i], SQLSRV_PARAM_IN));
}
} else {
$Procedimiento = "{call " . $Procedimiento . "}";
}
$stmt3 = sqlsrv_query($conn, $Procedimiento, $parametros);
if ($RetornaDatos) {
$array = array();
while ($obj = sqlsrv_fetch_array($stmt3, SQLSRV_FETCH_ASSOC)) {
$array[] = $obj;
}
return $array;
sqlsrv_free_stmt($stmt3);
}
sqlsrv_close($conn);
}
示例2: disconnect
/** Disconnects from database * */
function disconnect()
{
if (DB_TYPE == 'sqlsrv') {
if (@sqlsrv_close($this->_dbHandle) != 0) {
return 1;
} else {
return 0;
}
} else {
if (DB_TYPE == 'mssql') {
if (@mssql_close($this->_dbHandle) != 0) {
return 1;
} else {
return 0;
}
} else {
if (DB_TYPE == 'mysql') {
if (@mysql_close($this->_dbHandle) != 0) {
return 1;
} else {
return 0;
}
}
}
}
}
示例3: GetScheduleWithQuestionsOLD
function GetScheduleWithQuestionsOLD($groupid)
{
include_once 'db_Connection.php';
$conn = sqlsrv_connect($serverName, $connectionInfo);
$questionvalues = array();
$questions = array();
$schedule = array();
$schedulequestions = array();
if ($conn) {
//----get acadyear-------------------
$acid = 0;
$sqlstr = " SELECT [AcadYearID] FROM [dbo].[Groups] where [groupid]=? ";
$params = array($groupid);
$sqlquery = sqlsrv_query($conn, $sqlstr, $params);
if ($sqlquery) {
while ($row = sqlsrv_fetch_array($sqlquery, SQLSRV_FETCH_ASSOC)) {
$acid = $row['AcadYearID'];
}
sqlsrv_free_stmt($sqlquery);
}
$sqlstr = " SELECT [questionTypeId],[value],[text] " . " FROM [dbo].[QuestionValues] " . " order by questionTypeId ";
// $params = array ($acid);
$sqlquery = sqlsrv_query($conn, $sqlstr);
if ($sqlquery) {
while ($row = sqlsrv_fetch_object($sqlquery)) {
$questionvalues[] = $row;
}
sqlsrv_free_stmt($sqlquery);
}
//----get question array-------------------
$sqlstr = " SELECT [QuestionID],[QueastionText],[questionType],[maxmark],[NeedDescription],-1 as mark,'' as description " . " FROM [dbo].[Questions] " . " where [QuestionLecturer]=1 " . " and [Acadyear]=? ";
$params = array($acid);
$sqlquery = sqlsrv_query($conn, $sqlstr, $params);
if ($sqlquery) {
while ($row = sqlsrv_fetch_object($sqlquery)) {
$row->questionValues = array();
foreach ($questionvalues as &$questValue) {
if ($questValue->questionTypeId === $row->questionType) {
array_push($row->questionValues, $questValue);
}
}
$questions[] = $row;
}
sqlsrv_free_stmt($sqlquery);
}
//----get schadule array-------------------
$sqlstr = " SELECT distinct [SubjID],[SubjName],[STypeID],[STypeName], [LectID], [LectName] " . " FROM [dbo].[Schedule] " . " WHERE groupID=? " . " order by [SubjID],[STypeID] ";
$params = array($groupid);
$sqlquery = sqlsrv_query($conn, $sqlstr, $params);
if ($sqlquery) {
while ($row = sqlsrv_fetch_object($sqlquery)) {
$row->quests = $questions;
$schedule[] = $row;
}
$schedulequestions = array("result" => 0, "data" => $schedule);
}
sqlsrv_close($conn);
}
return $schedulequestions;
}
示例4: GetFacultyQuestions
function GetFacultyQuestions($groupid)
{
include_once 'db_Connection.php';
$conn = sqlsrv_connect($serverName, $connectionInfo);
$questionvalues = array();
$questions = array();
$faculty = array();
$facultyquestions = array();
if ($conn) {
//----get acadyear-------------------
$acid = 0;
$sqlstr = " SELECT [AcadYearID] FROM [dbo].[Groups] where [groupid]=? ";
$params = array($groupid);
$sqlquery = sqlsrv_query($conn, $sqlstr, $params);
if ($sqlquery) {
while ($row = sqlsrv_fetch_array($sqlquery, SQLSRV_FETCH_ASSOC)) {
$acid = $row['AcadYearID'];
}
sqlsrv_free_stmt($sqlquery);
}
$sqlstr = " SELECT [questionTypeId],[value],[text] " . " FROM [dbo].[QuestionValues] " . " order by questionTypeId ";
// $params = array ($acid);
$sqlquery = sqlsrv_query($conn, $sqlstr);
if ($sqlquery) {
while ($row = sqlsrv_fetch_object($sqlquery)) {
$questionvalues[] = $row;
}
sqlsrv_free_stmt($sqlquery);
}
//----get question array-------------------
$sqlstr = " SELECT [QuestionID],[QueastionText],[questionType],[maxmark],-1 as mark,'' as description " . " FROM [dbo].[Questions] " . " where [QuestionLecturer]=0 " . " and [Acadyear]=? ";
$params = array($acid);
$sqlquery = sqlsrv_query($conn, $sqlstr, $params);
if ($sqlquery) {
while ($row = sqlsrv_fetch_object($sqlquery)) {
$row->questionValues = array();
foreach ($questionvalues as &$questValue) {
if ($questValue->questionTypeId === $row->questionType) {
array_push($row->questionValues, $questValue);
}
}
$questions[] = $row;
}
sqlsrv_free_stmt($sqlquery);
}
//----get faculty-------------------
$sqlstr = " SELECT [FacultyID],[FacultyName] FROM [dbo].[Groups] " . " where [groupid]=? ";
$params = array($groupid);
$sqlquery = sqlsrv_query($conn, $sqlstr, $params);
if ($sqlquery) {
while ($row = sqlsrv_fetch_object($sqlquery)) {
$row->quests = $questions;
$faculty[] = $row;
}
$facultyquestions = array("result" => 0, "data" => $faculty);
}
sqlsrv_close($conn);
}
return $facultyquestions;
}
示例5: dbcall
function dbcall()
{
session_start();
$seubid = (string) session_id();
$server = "bamsql2";
$options = array("UID" => "genes", "PWD" => "Genes12", "Database" => "genes");
$conn = sqlsrv_connect($server, $options);
if ($conn === false) {
die("<pre>" . print_r(sqlsrv_errors(), true));
}
$rno = $_POST['Rnumber'];
$name = $_POST['name'];
$email = $_POST['email'];
$gender = $_POST['gender'];
$sql = "insert INTO dbo.contactinfo values('{$rno}','{$name}','{$email}','{$gender}')";
$query = sqlsrv_query($conn, $sql);
if ($query === false) {
exit("<pre>" . print_r(sqlsrv_errors(), true));
}
#while ($row = sqlsrv_fetch_array($query))
# { echo "<p>Hello, $row[ascore]!</p>";
#}
sqlsrv_free_stmt($query);
sqlsrv_close($conn);
}
示例6: SaveLecturerMarks
function SaveLecturerMarks($marks)
{
$status = array();
include_once 'db_Connection.php';
$conn = sqlsrv_connect($serverName, $connectionInfo);
if ($conn) {
$login = "0";
$subjectid = 0;
$subjtype = 0;
$lectid = 0;
$qid = 0;
$mark = 0;
$ldescription = "0";
$sqlstr = " insert into [dbo].[MarkLecturer] ([Login],[subjid],[subjtype],[lectid],[qid],[mark],[ldescription]) " . " values (?,?,?,?,?,?,?) ";
$params = array(&$login, &$subjectid, &$subjtype, &$lectid, &$qid, &$mark, &$ldescription);
$stmt = sqlsrv_prepare($conn, $sqlstr, $params);
if ($stmt) {
foreach ($marks as &$data) {
$login = $data->login;
$subjectid = $data->subjectid;
$subjtype = $data->subjtype;
$lectid = $data->lectid;
$qid = $data->qid;
$mark = $data->mark;
$ldescription = $data->description;
if (!sqlsrv_execute($stmt)) {
array_push($status, "not inserted-L" . $login . "-S" . $subjectid . "-T" . $subjtype . "-L" . $lectid . "-Q" . $qid);
}
}
}
sqlsrv_close($conn);
}
return $status;
}
示例7: disconnect
/**
* Close the connection.
*/
public function disconnect()
{
if ($this->connected()) {
sqlsrv_close($this->connection);
}
$this->connected = false;
}
示例8: __destruct
public function __destruct()
{
/*
| About:
| -> Close the connection and returns the elapsed time.
*/
if (!empty($this->connection['debugMode'])) {
$this->errorHandling();
}
switch ($this->connection['db_type']) {
case 'mysql':
$this->conn->close();
break;
case 'mssql':
mssql_close($this->conn);
break;
case 'sqlserv':
sqlsrv_close($this->conn);
break;
case 'pgsql':
pg_close($this->conn);
break;
}
return $this->elapsedTime();
}
示例9: close
/**
* @see MooMsSQL::close()
*
*/
public function close()
{
if ($this->linkId) {
sqlsrv_close($this->linkId);
$this->linkId = false;
}
}
示例10: close
/**
* Disconnect
*
* @return bool success
*/
public function close()
{
if ($this->handle && ($r = sqlsrv_close($this->handle))) {
$this->handle = NULL;
return $r;
}
return FALSE;
}
示例11: disconnectInternal
/**
* Disconnects from the database.
* Does nothing if there was no connection established.
*
* @return void
*/
protected function disconnectInternal()
{
if (!$this->isConnected) {
return;
}
$this->isConnected = false;
sqlsrv_close($this->resource);
}
示例12: CloseConnection
function CloseConnection()
{
if ($this->databaseType == 'mySql' || $this->databaseType == 'both') {
mysql_close($this->mysqlConnection);
}
if ($this->databaseType == 'sqlServer' || $this->databaseType == 'both') {
sqlsrv_close($this->sqlserverConnection);
}
}
示例13: close
protected function close()
{
if (isset($this->db)) {
$r = sqlsrv_close($this->db);
if ($r) {
$this->db = null;
}
}
}
示例14: close
/**
* This function closes an open connection.
*
* @access public
* @override
* @return boolean whether an open connection was closed
*/
public function close()
{
if ($this->is_connected()) {
if (!@sqlsrv_close($this->resource)) {
return FALSE;
}
$this->resource = NULL;
}
return TRUE;
}
示例15: close
public function close()
{
$this->conn_open = false;
if (!$this->reuse_connection) {
if ($this->handle && !$this->data_result) {
return sqlsrv_close($this->handle);
}
}
return true;
}