本文整理汇总了PHP中sql_close函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_close函数的具体用法?PHP sql_close怎么用?PHP sql_close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sql_close函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sql_error
/**
* Logs an sql error.
*
* @param string $message
* @return false
*/
function sql_error($message)
{
sql_close();
$message = trim($message) . "\n";
$message .= debug_string_backtrace() . "\n";
error_log('mysql_provider error: ' . $message);
return false;
}
示例2: query_to_value
function query_to_value($query)
{
$result = sql_query_dbg($query);
if ($row = sql_fetch_row($result)) {
sql_close($result);
return $row[0];
}
return FALSE;
}
示例3: couponcode
function couponcode($upc)
{
$man_id = substr($upc, 3, 5);
$fam = substr($upc, 8, 3);
$val = substr($upc, -2);
$db = pDataConnect();
$query = "select * from couponcodes where code = '" . $val . "'";
$result = sql_query($query, $db);
$num_rows = sql_num_rows($result);
if ($num_rows == 0) {
boxMsg("coupon type unknown<br>please enter coupon<br>manually");
} else {
$row = sql_fetch_array($result);
$value = $row["Value"];
$qty = $row["Qty"];
if ($fam == "992") {
$value = truncate2($value);
$_SESSION["couponupc"] = $upc;
$_SESSION["couponamt"] = $value;
maindisplay("coupondeptsearch.php");
} else {
sql_close($db);
$fam = substr($fam, 0, 2);
$query = "select " . "max(unitPrice) as total, " . "max(department) as department, " . "sum(ItemQtty) as qty, " . "sum(case when trans_status = 'C' then -1 else quantity end) as couponqtty " . "from localtemptrans where substring(upc, 4, 5) = '" . $man_id . "' " . "group by substring(upc, 4, 5)";
$db = tDataConnect();
$result = sql_query($query, $db);
$num_rows = sql_num_rows($result);
if ($num_rows > 0) {
$row = sql_fetch_array($result);
if ($row["couponqtty"] < 1) {
boxMsg("Coupon already applied<BR>for this item");
} else {
$dept = $row["department"];
$act_qty = $row["qty"];
if ($qty <= $act_qty) {
if ($value == 0) {
$value = -1 * $row["total"];
}
$value = truncate2($value);
addcoupon($upc, $dept, $value);
lastpage();
} else {
boxMsg("coupon requires " . $qty . "items<BR>there are only " . $act_qty . " item(s)<BR>in this transaction");
}
}
} else {
boxMsg("product not found<BR>in transaction");
}
// sql_close($db);
}
}
}
示例4: load
function load()
{
$query_member = "select * from custdata where CardNo = '205203'";
$query_product = "select * from products where upc = '0000000000090'";
$query_localtemptrans = "select * from localtemptrans";
$bdat = pDataConnect();
$result = sql_query($query_product, $bdat);
$result_2 = sql_query($query_member, $bdat);
sql_close($bdat);
$trans = tDataConnect();
$result_3 = sql_query($query_localtemptrans, $trans);
sql_close($trans);
}
示例5: nexttransno
function nexttransno()
{
$next_trans_no = 1;
$db = pDataConnect();
sql_query("update globalvalues set transno = transno + 1", $db);
$result = sql_query("select transno from globalvalues", $db);
$num_rows = sql_num_rows($result);
if ($num_rows != 0) {
$row = sql_fetch_array($result);
$next_trans_no = $row["transno"];
}
sql_close($db);
}
示例6: getChgName
function getChgName()
{
$query = "select LastName, FirstName from custdata where CardNo = '" . $_SESSION["memberID"] . "'";
$connection = pDataConnect();
$result = sql_query($query, $connection);
$row = sql_fetch_array($result);
$num_rows = sql_num_rows($result);
if ($num_rows > 0) {
if (strlen($_SESSION["memberID"]) != 4) {
$_SESSION["ChgName"] = $row["LastName"];
} elseif (strlen($_SESSION["memberID"]) == 4) {
$LastInit = substr($row["LastName"], 0, 1) . ".";
$_SESSION["ChgName"] = trim($row["FirstName"]) . " " . $LastInit;
} else {
$_SESSION["ChgName"] = $_SESSION["memMsg"];
}
}
sql_close($connection);
}
示例7: setglobalvalue
setglobalvalue("LoggedIn", 1);
loadglobalvalues();
$_SESSION["training"] = 1;
loginscreen();
} else {
$_SESSION["auth_fail"] = 1;
header("Location:/login.php");
}
} else {
if (get_user_info(user_pass($password)) == $global_values["CashierNo"]) {
loadglobalvalues();
testremote();
loginscreen();
} else {
if (user_pass_priv($password)) {
loadglobalvalues();
testremote();
loginscreen();
} else {
$_SESSION["auth_fail"] = 1;
header("Location:/login.php");
}
sql_close($db_a);
}
}
getsubtotals();
$_SESSION["datetimestamp"] = strftime("%Y-%m-%m/%d/%y %T", time());
if ($_SESSION["LastID"] != 0 && $_SESSION["memberID"] != "0" and $_SESSION["memberID"]) {
$_SESSION["unlock"] = 1;
memberID($_SESSION["memberID"]);
}
示例8: datareload
function datareload()
{
$query_mem = "select * from custdata where CardNo='205203'";
$query_prod = "select * from products where upc='0000000000090'";
$query_temp = "select * from localtemptrans";
$db_bdat = pDataConnect();
sql_query($query_prod, $db_bdat);
sql_query($query_mem, $db_bdat);
sql_close($db_bdat);
$db_trans = tDataConnect();
sql_query($query_temp, $db_trans);
sql_close($db_trans);
$_SESSION["datetimestamp"] = strftime("%Y-%m-%m/%d/%y %T", time());
}
示例9: gettransno
function gettransno($CashierNo)
{
$database = $_SESSION["tDatabase"];
$register_no = $_SESSION["laneno"];
$query = "SELECT max(trans_no) as maxtransno from localtranstoday where emp_no = '" . $CashierNo . "' and register_no = '" . $register_no . "' GROUP by register_no, emp_no";
$connection = tDataConnect();
$result = sql_query($query, $connection);
$row = sql_fetch_array($result);
if (!$row || !$row["maxtransno"]) {
$trans_no = 1;
} else {
$trans_no = $row["maxtransno"] + 1;
}
sql_close($connection);
return $trans_no;
}
示例10: _layout
function _layout($template, $page_title = false, $v_custom = false)
{
global $core, $user, $style, $starttime;
// GZip
if (_browser('gecko')) {
ob_start('ob_gzhandler');
}
// Headers
if (!headers_sent()) {
header('Cache-Control: private, no-cache="set-cookie", pre-check=0, post-check=0');
header('Expires: 0');
header('Pragma: no-cache');
}
if ($page_title !== false) {
if (!is_array($page_title)) {
$page_title = w($page_title);
}
foreach ($page_title as $k => $v) {
$page_title[$k] = _lang($v);
}
$page_title = implode(' . ', $page_title);
}
//
_lib_define();
$filename = strpos($template, '#') !== false ? str_replace('#', '.', $template) : $template . '.htm';
$style->set_filenames(array('body' => $filename));
// SQL History
if ($core->v('show_sql_history')) {
foreach (_sql_history() as $i => $row) {
if (!$i) {
_style('sql_history');
}
_style('sql_history.row', array('QUERY' => str_replace(array("\n", "\t"), array('<br />', ' '), $row)));
}
}
//
$v_assign = array('SITE_TITLE' => $core->v('site_title'), 'PAGE_TITLE' => $page_title, 'G_ANALYTICS' => $core->v('google_analytics'), 'S_REDIRECT' => $user->v('session_page'), 'F_SQL' => _sql_queries());
if ($v_custom !== false) {
$v_assign += $v_custom;
}
$mtime = explode(' ', microtime());
$v_assign['F_TIME'] = sprintf('%.2f', $mtime[0] + $mtime[1] - $starttime);
v_style($v_assign);
$style->pparse('body');
sql_close();
exit;
}
示例11: mHide
$sBuff .= '<tr><td><a href="#" onclick="dbexec(\'' . $dumptbl . '\');return false;">' . $tables . '</a></td></tr>';
}
}
}
$sBuff .= '</table></div>';
}
}
}
}
$sBuff .= '</td>
<td id="dbRes" style="vertical-align:top;width:100%;"></td>
</tr></tbody></table>';
if (isset($p['sqlinit'])) {
$sBuff .= mHide('jseval', 'dbhistory("s");');
}
sql_close($p['type'], $con);
} else {
$sBuff .= sDialog('Unable to connect to database');
}
} else {
$sqllist = array();
if (function_exists('mysql_connect') || function_exists('mysqli_connect')) {
$sqllist['mysql'] = 'MySQL [using mysql_* or mysqli_*]';
}
if (function_exists('mssql_connect') || function_exists('sqlsrv_connect')) {
$sqllist['mssql'] = 'MsSQL [using mssql_* or sqlsrv_*]';
}
if (function_exists('pg_connect')) {
$sqllist['pgsql'] = 'PostgreSQL [using pg_*]';
}
if (function_exists('oci_connect]')) {
示例12: dl_file
public function dl_file($name = '', $path = '', $data = '', $content_type = 'application/octet-stream', $disposition = 'attachment') {
sql_close();
$bad_chars = array("'", "\\", ' ', '/', ':', '*', '?', '"', '<', '>', '|');
$this->filename = ($name != '') ? $name : $this->filename;
$this->filepath = ($path != '') ? $path : $this->filepath;
$this->filename = rawurlencode(str_replace($bad_chars, '_', $this->filename));
$this->filename = 'RockRepublik__' . preg_replace("/%(\w{2})/", '_', $this->filename);
// Headers
header('Content-Type: ' . $content_type . '; name="' . $this->filename . '"');
header('Content-Disposition: ' . $disposition . '; filename="' . $this->filename . '"');
header('Accept-Ranges: bytes');
header('Pragma: no-cache');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-transfer-encoding: binary');
if ($data == '') {
$this->filepath = '../' . $this->filepath;
header('Content-length: ' . @filesize($this->filepath));
@readfile($this->filepath);
} else {
print($data);
}
flush();
exit;
}
示例13: checksuspended
function checksuspended()
{
testremote();
$db_a = tDataConnect();
$m_conn = mDataConnect();
$query_local = "select * from suspendedtoday";
$query_remote = "select * from " . trim($_SESSION["mServer"]) . "." . trim($_SESSION["mDatabase"]) . ".dbo.suspendedtoday";
$query = "select * from suspendedlist";
if ($_SESSION["standalone"] == 1) {
if ($_SESSION["remoteDBMS"] == "mssql") {
$result = mssql_query($query_local, $db_a);
} else {
$result = mysql_query($query, $db_a);
}
} else {
if ($_SESSION["remoteDBMS"] == "mssql") {
$result = sql_query($query_remote, $db_a);
} else {
$result = mysql_query($query, $m_conn);
}
}
$num_rows = sql_fetch_array($result);
if ($num_rows == 0) {
return 0;
} else {
return 1;
}
sql_close($db_a);
}
示例14: sql_close
$_SESSION["chargetender"] = 0;
}
$_SESSION["discounttotal"] = $headerRow["discountTTL"];
$_SESSION["memSpecial"] = $headerRow["memSpecial"];
sql_close($connect);
$queryID = "select * from custdata where CardNo = '" . $_SESSION["memberID"] . "'";
$connID = pDataConnect();
$result = sql_query($queryID, $connID);
$row = sql_fetch_array($result);
if ($row["Type"] == "PC") {
$_SESSION["isMember"] = 1;
} else {
$_SESSION["isMember"] = 0;
}
$_SESSION["memMsg"] = blueLine($row);
sql_close($connID);
if ($_SESSION["isMember"] == 1) {
$_SESSION["yousaved"] = number_format($_SESSION["transDiscount"] + $_SESSION["discounttotal"] + $_SESSION["memSpecial"] + $_SESSION["memCouponTTL"], 2);
$_SESSION["couldhavesaved"] = 0;
$_SESSION["specials"] = number_format($_SESSION["discounttotal"] + $_SESSION["memSpecial"], 2);
} else {
$dblyousaved = number_format($_SESSION["memSpecial"], 2);
$_SESSION["yousaved"] = $_SESSION["discounttotal"];
$_SESSION["couldhavesaved"] = number_format($_SESSION["memSpecial"], 2);
$_SESSION["specials"] = $_SESSION["discounttotal"];
}
// call to transLog, the body of the receipt comes from the view 'receipt'
$query = "select * from rp_receipt where register_no = " . $laneno . " and emp_no = " . $cashierNo . " and trans_no = " . $transno . " order by trans_id";
$db = tDataConnect();
$result = sql_query($query, $db);
$num_rows = sql_num_rows($result);
示例15: strtoupper
include_once "connect.php";
}
// apbw 5/3/05 BlueSkyFix
if (!function_exists("addcoupon")) {
include_once "additem.php";
}
// apbw 5/3/05 BlueSkyFix
$dept = strtoupper(trim($_POST["dept"]));
$dept = str_replace(".", "", $dept);
if ($dept == "CL") {
gohome();
} elseif (is_numeric(substr($dept, 2))) {
// apbw 5/3/05 BlueSkyFix
$dept = substr($dept, 2);
// apbw 5/3/05 BlueSkyFix
$upc = $_SESSION["couponupc"];
$val = $_SESSION["couponamt"];
$query = "select * from departments where dept_no = '" . $dept . "'";
$db = pDataConnect();
$result = sql_query($query, $db);
$num_rows = sql_num_rows($result);
if ($num_rows != 0) {
addcoupon($upc, $dept, $val);
gohome();
} else {
header("Location:coupondeptinvalid.php");
}
sql_close($db);
} else {
header("Location:coupondeptinvalid.php");
}