本文整理汇总了PHP中db2_close函数的典型用法代码示例。如果您正苦于以下问题:PHP db2_close函数的具体用法?PHP db2_close怎么用?PHP db2_close使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db2_close函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateTicket
function updateTicket()
{
// connect db=> stmt sql => insert => refresh page
if (isset($_POST)) {
$ticketshowID = $_POST['showid_value'];
}
$conn = dbConnect();
// start connect db
if ($conn) {
$insert = " INSERT INTO EMM_ZOO.TICKETSHOW_BUYING (TICKETSHOW_ID, SHOWID, ROUNDID , BUYING_DATE) VALUES (DEFAULT, '{$ticketshowID}',CURRENT TIME, CURRENT DATE);";
echo $insert;
$rc = db2_exec($conn, $insert);
if ($rc) {
header("Refresh:0; url=ShowList.php");
} else {
// If statement is error why see the code
die('Critical error:' . db2_stmt_error($stmt));
}
// finish all query statement
db2_free_stmt($rc);
db2_close($conn);
} else {
echo db2_conn_errormsg($conn);
}
}
示例2: orderoldfood
function orderoldfood()
{
if (isset($_POST)) {
$food_id = $_POST['food_id'];
$food_name = $_POST['food_name'];
$food_type = $_POST['food_type'];
$add_amount = $_POST['add_amount'];
$price_per = $_POST['price_per'];
$total = $add_amount * $price_per;
}
$conn = dbConnect();
if ($conn) {
$sql0 = "SELECT AMOUNT FROM EMM_ZOO.FM_STOCK WHERE FOODID = {$food_id};";
$stm = dbQuery($conn, $sql0);
while ($row = dbFetchArray($conn, $stm)) {
$amountx = $row[0];
}
$amount_now = $amountx + $add_amount;
$sql1 = "INSERT INTO EMM_ZOO.FOODANIMAL_EXPENSE (FOODEXPENSE_ID,DATES,FOODID,COST,RESPONPERSONID) VALUES (DEFAULT,CURRENT DATE,{$food_id},{$total},'5678');";
$cb = db2_exec($conn, $sql1);
$sql2 = "UPDATE EMM_ZOO.FM_STOCK SET AMOUNT = {$amount_now} WHERE FOODID = {$food_id};";
$cc = db2_exec($conn, $sql2);
if ($cc && $cb) {
$resultMessage = 1;
return $resultMessage;
header('Location: FoodStock.php#food_list');
} else {
$resultMessage = 0;
return $resultMessage;
}
db2_free_stmt($stmt);
db2_close($conn);
}
}
示例3: updateTicket
function updateTicket()
{
// connect db=> stmt sql => insert => refresh page
if (isset($_POST)) {
$tickettourID = $_POST['tourid_value'];
}
$conn = dbConnect();
// start connect db
if ($conn) {
$insert = " INSERT INTO EMM_ZOO.TICKETTOUR_TRANSACTION (TICKETTOUR_ID, TOUR_ID, DATE) VALUES (DEFAULT, '{$tickettourID}', CURRENT DATE);";
echo $insert;
$rc = db2_exec($conn, $insert);
if ($rc) {
header("Refresh:0; url=TourTicket.php");
} else {
// If statement is error why see the code
die('Critical error:' . db2_stmt_error($stmt));
}
// finish all query statement
db2_free_stmt($rc);
db2_close($conn);
} else {
echo db2_conn_errormsg($conn);
}
}
示例4: editEquipInfo
function editEquipInfo()
{
if (isset($_POST)) {
$equipid = $_POST['update_equipid'];
$equipname = $_POST['edit_equipname'];
$equiptype = $_POST['edit_equiptype'];
$status = $_POST['edit_status'];
}
$conn = dbConnect();
if ($conn) {
$sql = "UPDATE EMM_ZOO.SANITATION_EQUIP SET EQUIPID = '{$equipid}', EQUIPNAME = '{$equipname}' , EQUIPTYPE = '{$equiptype}', STATUS = '{$status}' WHERE EQUIPID = {$equipid};";
$result = db2_exec($conn, $sql);
if ($result) {
echo "<script>";
echo "alert('Updated successfully')";
echo "</script>";
header('Location: sani_equip.php#car_list');
exit;
} else {
$resultMessage = 0;
echo "<script>";
echo "alert('Updated unsuccessfully')";
echo "</script>";
return $resultMessage;
}
db2_free_stmt($stmt);
db2_close($conn);
} else {
echo db2_conn_errormsg();
}
}
示例5: editCarPlate
function editCarPlate()
{
if (isset($_POST)) {
$carid = $_POST['update_carid'];
$carplate = $_POST['edit_carplate'];
}
$conn = dbConnect();
if ($conn) {
$sql = "UPDATE EMM_ZOO.SANICAR SET CARID = '{$carid}', CARPLATE = '{$carplate}' WHERE CARID = {$carid};";
$result = db2_exec($conn, $sql);
if ($result) {
echo "<script>";
echo "alert('Updated successfully')";
echo "</script>";
header('Location: sani_garbage.php#car_list');
exit;
} else {
$resultMessage = 0;
echo "<script>";
echo "alert('Updated unsuccessfully')";
echo "</script>";
return $resultMessage;
}
db2_free_stmt($stmt);
db2_close($conn);
} else {
echo db2_conn_errormsg();
}
}
示例6: uploadBioInfo
function uploadBioInfo()
{
if (!isset($_SESSION['current_user_name']) && !isset($_COOKIE[$cookie_name])) {
header('Location: ../login.php');
exit;
} else {
//print_r($_POST);
if (isset($_POST)) {
$AnimalID = $_POST['AnimalID'];
$species = $_POST['species'];
$Phylum = $_POST['Phylum'];
$Class = $_POST['Class'];
$Order = $_POST['Order'];
$Family = $_POST['Family'];
$Genus = $_POST['Genus'];
$warmblooded = $_POST['warmblooded'];
$Cover = $_POST['Cover'];
$Reproduction = $_POST['Reproduction'];
$Habitat = $_POST['Habitat'];
$food = $_POST['food'];
$BodyTemp = $_POST['BodyTemp'];
$EnviTemp = $_POST['EnviTemp'];
$LifeSpan = $_POST['LifeSpan'];
// an array that want to insert this can be multiple array at the time.
$data = array($AnimalID, $species, $Phylum, $Class, $Order, $Family, $Genus, $warmblooded, $Cover, $Reproduction, $Habitat, $food, $BodyTemp, $EnviTemp, $LifeSpan);
// print var_dump to display an array of variable data with type that prepare for query.
//echo var_dump($data) ."<br>";
}
require_once '/var/www/html/app/model/connect.php';
$conn = dbConnect();
if ($conn) {
// DEFAULT if you set generated as identify with specifier this will auto increament for integer.
$sql = 'INSERT INTO EMM_ZOO.BIOINFO (SPECIESID,SPECIESNAME, PHYLUM, CLASS, ORDER, FAMILY, GENUS, WARMBLOODED, BODYCOVER, REPRODUCTION, HABITAT, COMMONFOOD, BODYTEMP, ENVITEMPRANGE, LIFESPAN) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);';
//echo $sql;
// prepare statement using connection and sql
$stmt = db2_prepare($conn, $sql);
// If statement is valid execute it to db2
if ($stmt) {
//echo "SQL is valid<br>";
$result = db2_execute($stmt, $data);
if ($result) {
$resultMessage = "Successfully added to Biological information";
echo "Successfully added";
header('Location: BioInfo.php');
exit;
} else {
$resultMessage = "Failed to query into database";
}
} else {
// If statement is error why see the code
die('Critical error:' . db2_stmt_error());
}
db2_free_stmt($stmt);
db2_close($conn);
} else {
echo db2_conn_errormsg();
}
}
}
示例7: insertSaniEmp
function insertSaniEmp()
{
//print_r($_POST);
if (isset($_POST)) {
$empid = $_POST['empid'];
$zoneid = $_POST['zoneid'];
$jobid = '17';
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$birthdate = $_POST['birthdate'];
$sex = $_POST['sex'];
$nationality = $_POST['nationality'];
$hiredate = $_POST['hiredate'];
$address = $_POST['address'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$salary = $_POST['salary'];
$bonus = $_POST['bonus'];
// an array that want to insert this can be multiple array at the time.
$data = array($empid, $zoneid, $jobid, $firstname, $lastname, $birthdate, $sex, $nationality, $hiredate, $address, $email, $phone, $salary, $bonus);
// print var_dump to display an array of variable data with type that prepare for query.
//echo var_dump($data) ."<br>";
}
// define $conn from model
$conn = dbConnect();
if ($conn) {
$sql = 'INSERT INTO EMM_ZOO.EMPLOYEE (EMPID, ZONEID, JOBID, FIRSTNAME, LASTNAME, BIRTHDATE, SEX, NATIONALITY, HIREDATE, ADDRESS, EMAIL, PHONE, SALARY, BONUS) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?);';
//$sql2 = 'INSERT INTO EMM_ZOO.EMP_SANI (EMPID) VALUES (?);';
//echo $sql;
// prepare statement using connection and sql
$stmt = db2_prepare($conn, $sql);
// If statement is valid execute it to db2
if ($stmt) {
//echo "SQL is valid<br>";
$result = db2_execute($stmt, $data);
if ($result) {
$resultMessage = "Successfully added to sanitation employee";
//echo "Successfully added";
echo "<script>";
echo "alert('Added successfully')";
echo "</script>";
header('Location: addEmpHome.php');
exit;
} else {
$resultMessage = "Failed to query into database";
echo "<script>";
echo "alert('Failed to query into database')";
echo "</script>";
}
} else {
// If statement is error why see the code
die('Critical error:' . db2_stmt_error());
}
db2_free_stmt($stmt);
db2_close($conn);
} else {
echo db2_conn_errormsg();
}
}
示例8: close
public function close()
{
$this->conn_open = false;
if (!$this->reuse_connection) {
if ($this->handle && !$this->data_result) {
return db2_close($this->handle);
}
}
return true;
}
示例9: close
/**
* This function closes an open connection.
*
* @access public
* @override
* @return boolean whether an open connection was closed
*
* @see http://www.php.net/manual/en/function.db2-close.php
*/
public function close()
{
if ($this->is_connected()) {
if (!@db2_close($this->resource)) {
return FALSE;
}
$this->resource = NULL;
}
return TRUE;
}
示例10: db2_test
function db2_test()
{
$conn_string = variable_get('simsauth_connect_string');
$db2_conn = db2_connect($conn_string, '', '');
if ($db2_conn) {
db2_close($db2_conn);
return TRUE;
} else {
return FALSE;
}
}
示例11: insertBuilding
function insertBuilding()
{
if ($_POST['form_token'] != $_SESSION['form_token']) {
header('Location:index.php');
} else {
//print_r($_POST);
if (isset($_POST)) {
$emm = $_POST['BEmp'];
$zone = $_POST['BZone'];
$build = $_POST['Building'];
$floor = $_POST['floor'];
$room = $_POST['room'];
// an array that want to insert this can be multiple array at the time.
$data = array($build, $floor, $room);
// print var_dump to display an array of variable data with type that prepare for query.
//echo var_dump($data) ."<br>";
}
// define $conn from model
$conn = dbConnect();
if ($conn) {
// DEFAULT if you set generated as identify with specifier this will auto increament for integer.
$sql = 'INSERT INTO EMM_ZOO.MAINTAINBUILDING (MAINTEGERAINID, BUILDINGNAME, FLOORLEVEL, ROOM) VALUES (DEFAULT,?,?,?);';
//echo $sql;
// prepare statement using connection and sql
$stmt = db2_prepare($conn, $sql);
// If statement is valid execute it to db2
if ($stmt) {
//echo "SQL is valid<br>";
$result = db2_execute($stmt, $data);
if ($result) {
$resultMessage = "Successfully added";
//echo "Successfully added";
echo "<script>";
echo "alert('Successfully')";
echo "</script>";
header('Location: index.php');
exit;
} else {
echo "<script>";
echo "alert('Failed')";
echo "</script>";
$resultMessage = "Failed to query into database";
}
} else {
// If statement is error why see the code
die('Critical error:' . db2_stmt_error());
}
db2_free_stmt($stmt);
db2_close($conn);
} else {
echo db2_conn_errormsg();
}
}
}
示例12: disConnect
/**
* {@inheritdoc}
*/
public function disConnect()
{
if ($this->result) {
db2_free_result($this->result);
}
if (is_resource($this->connection)) {
$this->connected = !db2_close($this->connection);
} else {
$this->connected = false;
}
return !$this->connected;
}
示例13: updateTicket
function updateTicket()
{
// connect db=> stmt sql => insert => refresh page
if (isset($_POST['id_value'])) {
$transID = $_POST['id_value'];
}
$conn = dbConnect();
// start connect db
if ($conn) {
$update = "UPDATE EMM_ZOO.TICKETTRANS_TRANSACTION SET TICKETTRANS_TIMEIN = CURRENT TIME WHERE TICKETTRANS_ID = " . $transID . ";";
//echo $update;
$rc = db2_exec($conn, $update);
if ($rc) {
//header("Refresh:0; url=TranspotationIN.php");
} else {
// If statement is error why see the code
die('Critical error:' . db2_stmt_error($stmt));
}
// finish all query statement
db2_free_stmt($rc);
$sql = "SELECT * FROM EMM_ZOO.TICKETTRANS_TRANSACTION JOIN EMM_ZOO.TICKETTRANS_TYPE ON VEHICLETRANS_ID = TRANSTYPE_ID WHERE TICKETTRANS_ID = " . $transID . ";";
$stmt = db2_exec($conn, $sql);
while ($row = db2_fetch_assoc($stmt)) {
$tran_price = $row['TRANSTYPE_PRICE'];
$tran_type = $row['TRANSTYPE_NAME'];
$hourOut = (int) substr($row['TICKETTRANS_TIMEOUT'], 0, 2);
$hourIn = (int) substr($row['TICKETTRANS_TIMEIN'], 0, 2);
$extraOut = (int) substr($row['TICKETTRANS_TIMEOUT'], 3, 2);
$extraIn = (int) substr($row['TICKETTRANS_TIMEIN'], 3, 2);
$price = ($hourIn - $hourOut) * $tran_price;
// ราคาต้องดึงมาจาก trans_Type table
if ($extraIn - $extraOut > 0) {
$price += $tran_price;
}
if ($extraIn - $extraOut == 0 && $hourIn - $hourOut == 0 && (int) substr($row['TICKETTRANS_TIMEOUT'], 6, 2) != (int) substr($row['TICKETTRANS_TIMEIN'], 6, 2)) {
$price += $tran_price;
}
if ($stmt) {
// echo "Insert successfully!!";
echo "<script>alert('Price of {$tran_type} is {$price}');window.location='TranspotationIN.php';</script>";
//header("Refresh:0; url=TranspotationIN.php");
} else {
// If statement is error why see the code
die('Critical error:' . db2_stmt_error($stmt));
}
}
db2_free_stmt($rc);
db2_close($conn);
} else {
echo db2_conn_errormsg($conn);
}
}
示例14: insertUselog
function insertUselog()
{
//print_r($_POST);
if (isset($_POST)) {
$equipid = $_POST['equipid'];
$equipname = $_POST['equipname'];
$empid = $_POST['empid'];
$zoneid = $_POST['zoneid'];
$borrowdate = $_POST['borrowdate'];
$returndate = $_POST['returndate'];
// an array that want to insert this can be multiple array at the time.
$data = array($equipid, $equipname, $empid, $zoneid);
// print var_dump to display an array of variable data with type that prepare for query.
//echo var_dump($data) ."<br>";
}
// define $conn from model
$conn = dbConnect();
if ($conn) {
$sql = 'INSERT INTO EMM_ZOO.SANI_EQUIPUSELOG (EQUIPID, EMPID, WORKZONEID, BORROWDATE, RETURNDATE) VALUES (?,?,?,?,?);';
//$sql2 = 'INSERT INTO EMM_ZOO.EMP_SANI (EMPID) VALUES (?);';
//echo $sql;
// prepare statement using connection and sql
$stmt = db2_prepare($conn, $sql);
// If statement is valid execute it to db2
if ($stmt) {
//echo "SQL is valid<br>";
$result = db2_execute($stmt, $data);
if ($result) {
$resultMessage = "Successfully added to Equipment use log";
//echo "Successfully added";
echo "<script>";
echo "alert('Added successfully')";
echo "</script>";
header('Location: addUselogHome.php');
exit;
} else {
$resultMessage = "Failed to query into database";
echo "<script>";
echo "alert('Failed to query into database')";
echo "</script>";
}
} else {
// If statement is error why see the code
die('Critical error:' . db2_stmt_error());
}
db2_free_stmt($stmt);
db2_close($conn);
} else {
echo db2_conn_errormsg();
}
}
示例15: insertEmpAtt
function insertEmpAtt()
{
//print_r($_POST);
if (isset($_POST)) {
$attno = $_POST['attno'];
$dates = $_POST['dates'];
$empid = $_POST['empid'];
$workzoneid = $_POST['workzoneid'];
$dutyid = $_POST['carplate'];
$starttime = $_POST['starttime'];
$endtime = $_POST['endtime'];
// an array that want to insert this can be multiple array at the time.
$data = array($attno, $dates, $empid, $workzoneid, $dutyid, $starttime, $endtime);
// print var_dump to display an array of variable data with type that prepare for query.
//echo var_dump($data) ."<br>";
}
// define $conn from model
$conn = dbConnect();
if ($conn) {
$sql = 'INSERT INTO EMM_ZOO.SANIEMP_ATTEND (ATTENDNO, DATES, EMPID, WORKZONEID, DUTYID, STARTTIME, ENDTIME) VALUES (?,?,?,?,?,?,?);';
// prepare statement using connection and sql
$stmt = db2_prepare($conn, $sql);
// If statement is valid execute it to db2
if ($stmt) {
//echo "SQL is valid<br>";
$result = db2_execute($stmt, $data);
if ($result) {
$resultMessage = "Successfully added to sanitation car";
//echo "Successfully added";
echo "<script>";
echo "alert('Added successfully')";
echo "</script>";
header('Location: addCarHome.php');
exit;
} else {
$resultMessage = "Failed to query into database";
echo "<script>";
echo "alert('Failed to query into database')";
echo "</script>";
}
} else {
// If statement is error why see the code
die('Critical error:' . db2_stmt_error());
}
db2_free_stmt($stmt);
db2_close($conn);
} else {
echo db2_conn_errormsg();
}
}