当前位置: 首页>>代码示例>>PHP>>正文


PHP Sql_exec函数代码示例

本文整理汇总了PHP中Sql_exec函数的典型用法代码示例。如果您正苦于以下问题:PHP Sql_exec函数的具体用法?PHP Sql_exec怎么用?PHP Sql_exec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Sql_exec函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setHistory

function setHistory($options = array())
{
    $defaultOptions = array();
    $defaultOptions['page_name'] = '';
    $defaultOptions['action_type'] = '';
    $defaultOptions['table'] = '';
    $defaultOptions['id_name'] = 'id';
    $defaultOptions['id_value'] = '';
    $defaultOptions['remote'] = false;
    $defaultOptions['pname'] = '';
    $options = array_merge($defaultOptions, $options);
    extract($options);
    $localcn = connectDB();
    $user_id = $_SESSION['UserID'];
    $user_name = $_SESSION['UserName'];
    if ($localcn == '' || trim($action_type) == '' || trim($table) == '' || trim($id_value) == '' || trim($remote) == true && trim($pname) == '' || trim($action_type) != "add" && trim($action_type) != "delete" && trim($action_type) == 'edit') {
        return false;
    }
    $connection_string = $localcn;
    $remote_name = NULL;
    if ($remote === true) {
        $remoteCn = remote_connectDB($pname);
        $connection_string = $remoteCn;
        $remote_name = $pname;
    }
    $qry = "Select * from `{$table}` where {$id_name} = '{$id_value}'";
    $res = Sql_exec($connection_string, $qry);
    $result = Sql_fetch_assoc($res);
    $value_json = json_encode($result);
    if ($remoteCn) {
        ClosedDBConnection($remoteCn);
        rollback_main_connectDB();
    }
    if ($action_type == 'update') {
        $comments = 'Updated !';
    } elseif ($action_type == 'add') {
        $comments = 'Inserted !';
    }
    $row_value = $value_json;
    $action_command = $action_type;
    if ($page_name == "") {
        $page_name = $table;
    }
    $table_name = $table;
    $action_date = date("Y-m-d", strtotime("now"));
    $action_time = date("H:i:s", strtotime("now"));
    $ip_address = $_SERVER['REMOTE_ADDR'];
    $browser = $_SERVER['HTTP_USER_AGENT'];
    $referrer = $_SERVER['HTTP_REFERER'];
    $qry = "INSERT INTO tbl_audit_trail (user_id,user_name,action_command,pname,page_name,table_name,primary_key_column,action_date,action_time,rowvalue,comments,ip_address,browser,referer) VALUES";
    $qry .= "('{$user_id}','{$user_name}','{$action_command}','{$remote_name}','{$page_name}','{$table_name}','{$id_name}','{$action_date}','{$action_time}','{$row_value}','{$comments}','{$ip_address}','{$browser}', '{$referrer}');";
    $result = Sql_exec($localcn, $qry);
    $insert_id = Sql_insert_id($localcn);
    return $insert_id;
}
开发者ID:Allvee,项目名称:Softswitch,代码行数:55,代码来源:audit.php

示例2: DEL

 function DEL()
 {
     $code_parametre = $this->code_parametre;
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "sys_parametres\n                WHERE code_parametre = '{$code_parametre}'\n                AND id_utilisateur = {$id_utilisateur}";
     if (!Sql_exec($sql)) {
         $this->setError(ERROR);
     }
     if (!$this->isError()) {
         Lib_sqlLog($sql);
     }
     return;
 }
开发者ID:xVirusproj3ct,项目名称:site_web_phf,代码行数:12,代码来源:parametre.inc.php

示例3: DEL

 function DEL()
 {
     $nom_utilisateur = $this->nom_utilisateur;
     $adresse_ip = $this->adresse_ip;
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "sys_ip_interdictions\n\t\t\t\t\t WHERE adresse_ip = '{$adresse_ip}'\n\t\t\t\t\t AND nom_utilisateur = '{$nom_utilisateur}'\n\t\t\t\t\t LIMIT 1";
     if (!Sql_exec($sql)) {
         $this->setError(ERROR);
     }
     if (!$this->isError()) {
         Lib_sqlLog($sql);
     }
     return;
 }
开发者ID:xVirusproj3ct,项目名称:site_web_phf,代码行数:13,代码来源:ip_interdiction.inc.php

示例4: DEL

 function DEL()
 {
     if ($this->id_groupe == "" || $this->adresse_ip == "") {
         trigger_error("L'autorisation ne peut être supprimée sans groupe ni adresse IP!", E_USER_ERROR);
         return NULL;
     }
     $id_groupe = $this->id_groupe;
     $adresse_ip = $this->adresse_ip;
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "sys_ip_autorisations\n\t\t\t\t\t WHERE id_groupe = {$id_groupe}\n\t\t\t\t\t AND adresse_ip = '{$adresse_ip}'\n\t\t\t\t\t LIMIT 1";
     if (!Sql_exec($sql)) {
         $this->setError(ERROR);
     }
     if (!$this->isError()) {
         Lib_sqlLog($sql);
     }
     return;
 }
开发者ID:xVirusproj3ct,项目名称:site_web_phf,代码行数:17,代码来源:ip_autorisation.inc.php

示例5: Sql_exec

try {
    $res = Sql_exec($cn, $qry);
    $is_error = 0;
} catch (Exception $e) {
    $is_error = 1;
}
if ($is_error == 1) {
    $return_data = array('status' => false, 'message' => 'Submission Failed');
} else {
    $return_data = array('status' => true, 'message' => $msg);
}
echo json_encode($return_data);
$qry_inbound = "SELECT `ip_address`,`port`,`ep_type`,`user_name`,`password` FROM tbl_softswitch_gateway WHERE `name`='{$soft_inbound_gw}'";
$qry_outbound = "SELECT `ip_address`,`port`,`auth` FROM tbl_softswitch_gateway WHERE `name`='{$soft_outbound_gw}'";
$res_inbound = Sql_exec($cn, $qry_inbound);
$res_outbound = Sql_exec($cn, $qry_outbound);
$data = array();
$data1 = array();
$data2 = array();
$i = 0;
while ($row_inbound = Sql_fetch_array($res_inbound)) {
    $j = 0;
    $data[$i][$j++] = Sql_Result($row_inbound, "ep_type");
    $data[$i][$j++] = Sql_Result($row_inbound, "ip_address");
    $data[$i][$j++] = Sql_Result($row_inbound, "port");
    $data[$i][$j++] = Sql_Result($row_inbound, "user_name");
    $data[$i][$j++] = Sql_Result($row_inbound, "password");
    $i++;
}
$i = 0;
while ($row_outbound = Sql_fetch_array($res_outbound)) {
开发者ID:Allvee,项目名称:Softswitch,代码行数:31,代码来源:add_soft_dial_plan.php

示例6: Sql_exec

    if ($function_point != null && $function_point != '' && $function_point != 'null') {
        $count_qry .= " AND `function_point` LIKE '%" . $function_point . "%' ";
        //$load_qry 	.= " AND `function_point` LIKE '%".$function_point."%' ";
    }
    if ($comment != null && $comment != '' && $comment != 'null') {
        $count_qry .= " AND `comment` LIKE '%" . $comment . "%' ";
        //$load_qry 	.= " AND `comment` LIKE '%".$comment."%' ";
    }
    if ($sip != null && $sip != '' && $sip != 'null') {
        $count_qry .= " AND `sip` LIKE '%" . $sip . "%' ";
        //$load_qry 	.= " AND `sip` LIKE '%".$sip."%' ";
    }
    $key = 'id';
    $extraBtn = false;
}
$res = Sql_exec($cn, $count_qry);
while ($row = Sql_fetch_array($res)) {
    $j = 0;
    $data_[$i][$j++] = Sql_Result($row, "sender_type");
    $data_[$i][$j++] = Sql_Result($row, "log_type");
    $data_[$i][$j++] = Sql_Result($row, "submit_time");
    $data_[$i][$j++] = Sql_Result($row, "submit_time_to");
    $data_[$i][$j++] = Sql_Result($row, "log_time");
    $data_[$i][$j++] = Sql_Result($row, "log_to_time");
    $data_[$i][$j++] = Sql_Result($row, "fromId");
    $data_[$i][$j++] = Sql_Result($row, "toId");
    $data_[$i][$j++] = Sql_Result($row, "user_type");
    $data_[$i][$j++] = Sql_Result($row, "source_ip");
    $data_[$i][$j++] = Sql_Result($row, "source_port");
    $data_[$i][$j++] = Sql_Result($row, "functionName");
    $data_[$i][$j++] = Sql_Result($row, "audio_ip");
开发者ID:Allvee,项目名称:Softswitch,代码行数:31,代码来源:search_log_management_info.php

示例7: Sql_exec

if ($function_point != null && $function_point != '' && $function_point != 'null') {
    //$count_qry	.= " AND `function_point` LIKE '%".$function_point."%' ";
    $load_qry .= " AND `function_point` LIKE '%" . $function_point . "%' ";
}
if ($comment != null && $comment != '' && $comment != 'null') {
    //$count_qry	.= " AND `comment` LIKE '%".$comment."%' ";
    $load_qry .= " AND `comment` LIKE '%" . $comment . "%' ";
}
if ($sip != null && $sip != '' && $sip != 'null') {
    //$count_qry	.= " AND `sip` LIKE '%".$sip."%' ";
    $load_qry .= " AND `sip` LIKE '%" . $sip . "%' ";
}
$key = 'id';
$extraBtn = false;
//echo $count_qry;$load_qry;
$res = Sql_exec($remoteCn, $load_qry);
$i = 0;
$data = array();
while ($row = Sql_fetch_array($res)) {
    $j = 0;
    $data[$i] = array();
    $data[$i][$j++] = Sql_Result($row, "log_server_time");
    $data[$i][$j++] = Sql_Result($row, "source");
    $data[$i][$j++] = Sql_Result($row, "type");
    $data[$i][$j++] = Sql_Result($row, "source_timestamp");
    $data[$i][$j++] = Sql_Result($row, "from_user");
    $data[$i][$j++] = Sql_Result($row, "to_user");
    $data[$i][$j++] = Sql_Result($row, "call_id");
    $data[$i][$j++] = Sql_Result($row, "caller_callee");
    $data[$i][$j++] = Sql_Result($row, "source_ip");
    $data[$i][$j++] = Sql_Result($row, "source_port");
开发者ID:Allvee,项目名称:Softswitch,代码行数:31,代码来源:search_log_management_info.php

示例8: remote_connectDB

function remote_connectDB($pname, $pname_field = 'pname', $table_name = 'tbl_process_db_access')
{
    $cn = connectDB();
    $remoteCnQry = "select * from {$table_name} where {$pname_field}='{$pname}'";
    $res = Sql_exec($cn, $remoteCnQry);
    $dt = Sql_fetch_array($res);
    global $dbtype;
    global $UserID;
    global $Password;
    global $Server;
    global $Database;
    global $temp_dbtype;
    global $temp_UserID;
    global $temp_Password;
    global $temp_Server;
    global $temp_Database;
    $temp_dbtype = $dbtype;
    $temp_UserID = $UserID;
    $temp_Password = $Password;
    $temp_Server = $Server;
    $temp_Database = $Database;
    $dbtype = $dt['db_type'];
    $Server = $dt['db_server'];
    $UserID = $dt['db_uid'];
    $Password = $dt['db_password'];
    $Database = $dt['db_name'];
    ClosedDBConnection($cn);
    $cn = connectDB();
    return $cn;
}
开发者ID:Allvee,项目名称:Softswitch,代码行数:30,代码来源:common.php

示例9: News_insert

function News_insert($data)
{
    $sql = "INSERT INTO messages (dt, news, text) VALUES\n\t('" . date('Y-m-d H:i:s') . "', '" . $data['news'] . "', '" . $data['text'] . "')";
    //echo $sql;die; //отладка
    Sql_exec($sql);
}
开发者ID:Oksana-999,项目名称:test,代码行数:6,代码来源:news.php

示例10: connectDB

if (isset($data['server_id']) && $data['server_id'] && isset($data['service_id']) && $data['service_id']) {
    $cn = connectDB();
    $server_id = mysql_real_escape_string(htmlspecialchars($data['server_id']));
    $service_id = mysql_real_escape_string(htmlspecialchars($data['service_id']));
    $qry = "SELECT * FROM tbl_obd_server_config WHERE id='{$server_id}'";
    $res = Sql_exec($cn, $qry);
    $dt = Sql_fetch_array($res);
    $dbtype = $dt['db_type'];
    $Server = $dt['db_server'];
    $UserID = $dt['db_user'];
    $Password = $dt['db_password'];
    $Database = $dt['db_name'];
    ClosedDBConnection($cn);
    $remoteConnection = connectDB();
    $qry = "SELECT OutDialStatus, COUNT(*) as num FROM outdialque WHERE UserId='{$service_id}' GROUP BY OutDialStatus ORDER BY OutDialStatus ASC";
    $result = Sql_exec($remoteConnection, $qry);
    if (!$result) {
        echo "err+" . $qry . " in line " . __LINE__ . " of file" . __FILE__;
        exit;
    }
    $data = array();
    $i = 0;
    while ($row = Sql_fetch_array($result)) {
        $j = 0;
        $data[$i][$j++] = Sql_Result($row, "OutDialStatus");
        $data[$i][$j++] = Sql_Result($row, "num");
        if (Sql_Result($row, "OutDialStatus") == "QUE") {
            $data[$i][$j++] = '<span  onclick="stop_obd_operation(this,' . "'" . Sql_Result($row, "OutDialStatus") . "'" . '); return false;">&nbsp;<img style="position: relative; cursor: pointer; top: 4px" width="16" height="16" border="0" src="rcportal/img/stop.png" ></span>';
        } else {
            $data[$i][$j++] = '<span onclick="download_obd_dashboard(this,' . "'" . Sql_Result($row, "OutDialStatus") . "'" . '); return false;">&nbsp;<img style="position: relative; cursor: pointer; top: 4px" width="16" height="16" border="0" src="rcportal/img/download.png" ></span>';
        }
开发者ID:Allvee,项目名称:Softswitch,代码行数:31,代码来源:show_obd_dashboard.php

示例11: remote_connectDB

<?php

require_once "../lib/common.php";
$remoteCn = remote_connectDB('ISMP');
$qry = "SELECT \t`app_id`,`app_name`,`config` FROM `tbl_smsgw_config` WHERE `app_id` = 1 AND `app_name` = 'smsgw'";
$res = Sql_exec($remoteCn, $qry);
$dt = Sql_fetch_array($res);
$decode = $dt['config'];
$decode = json_decode($decode, true);
$data = array();
foreach ($decode as $key => $val) {
    $data[$key] = $val;
}
$data['action_id'] = $dt['app_id'];
echo json_encode($data);
ClosedDBConnection($remoteCn);
开发者ID:Allvee,项目名称:Softswitch,代码行数:16,代码来源:get_smsgw_config.php

示例12: DEL

 /**
 	Cette fonction supprime un chantier de la BDD.
 */
 function DEL()
 {
     if ($this->isError()) {
         return;
     }
     $id_post_auteur = $this->id_post_auteur;
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "post_auteur\n\t\t\t\tWHERE id_post_auteur = {$id_post_auteur}";
     if (!Sql_exec($sql)) {
         $this->setError(ERROR);
     }
     if (!$this->isError()) {
         Lib_sqlLog($sql);
     }
     return;
 }
开发者ID:xVirusproj3ct,项目名称:site_web_phf,代码行数:18,代码来源:post_auteur.inc.php

示例13: connectDB

<?php

include_once "../lib/common.php";
$cn = connectDB();
$arrayInput = array();
//$res = Sql_exec($cn,$remoteCnQry);
//$dt = Sql_fetch_array($res);
$query = "select * FROM tbl_ch_server_info";
$result = Sql_exec($cn, $query);
if (!$result) {
    echo "err+" . $query . " in line " . __LINE__ . " of file" . __FILE__;
    exit;
}
$data = array();
$i = 0;
while ($row = Sql_fetch_array($result)) {
    $j = 0;
    $data[$i][$j++] = Sql_Result($row, "server_name");
    $data[$i][$j++] = Sql_Result($row, "db_type");
    $data[$i][$j++] = Sql_Result($row, "database_server");
    $data[$i][$j++] = Sql_Result($row, "user_id");
    $data[$i][$j++] = Sql_Result($row, "database_password");
    $data[$i][$j++] = Sql_Result($row, "database_name");
    $data[$i][$j++] = Sql_Result($row, "prompt_location");
    $data[$i][$j++] = Sql_Result($row, "url");
    $data[$i][$j++] = Sql_Result($row, "recording_location");
    $data[$i][$j++] = '<span  onclick="edit_input_form_ivr_server_info(this,' . "'" . Sql_Result($row, "server_name") . "'" . '); return false;"  > &nbsp;<img style="position: relative; cursor: pointer; top: 4px" width="16" height="16" border="0" src="rcportal/img/pen.png" >
</span>' . '<span    " onclick="delete_ivr_server_info(this,' . "'" . Sql_Result($row, "server_name") . "'" . '); return false;"  > &nbsp;<img style="position: relative; cursor: pointer; top: 4px" width="16" height="16" border="0" src="rcportal/img/cancel.png" >
</span>';
    $i++;
}
开发者ID:Allvee,项目名称:Softswitch,代码行数:31,代码来源:ivr_server_info_view.php

示例14: Photo_insert

function Photo_insert($data)
{
    $sql = "INSERT INTO images (title, path) VALUES\n            ('" . $data['title'] . "','" . $data['image'] . "')";
    Sql_exec($sql);
}
开发者ID:RichardSyfer,项目名称:php_lessons,代码行数:5,代码来源:photo.php

示例15: ClosedDBConnection

$Server = $dt['db_server'];
$UserID = $dt['db_uid'];
$Password = $dt['db_password'];
$Database = $dt['db_name'];
ClosedDBConnection($cn);
$text = '';
$encodedMsg = rawurlencode($msg);
$encodedMsg = str_replace('.', '%2E', $encodedMsg);
$text .= $dstMN . '|' . $encodedMsg;
$count_qry = "select count(UserID) as c_user from `user` where `UserName`= '" . $_SESSION["UserID"] . "'";
$insert_qry = "insert into `user` (`UserName`,`Password`) values ('" . $_SESSION["UserID"] . "','ssdt')";
$remoteCn = connectDB();
$rs = Sql_exec($remoteCn, $count_qry);
$dt = Sql_fetch_array($rs);
$c_user = intval($dt['c_user']);
if ($c_user == 0) {
    Sql_exec($remoteCn, $insert_qry);
}
ClosedDBConnection($remoteCn);
$url = $single_sms_url . "UserName=" . $_SESSION["UserID"] . "&Password=ssdt&Sender=";
//"http://localhost/SendSMS/sendSingleSMS.php?UserName=admin&Password=admin&Sender=1234&text=";
$url .= $srcMN;
$url .= "&text=" . $text;
//$url .="&NO=".$count;
//echo $url;
$response = file_get_contents($url);
if (trim($response) == trim("Successfully inserted to smsoutbox")) {
    echo 0;
} else {
    echo 1;
}
开发者ID:Allvee,项目名称:Softswitch,代码行数:31,代码来源:submit_single_sms.php


注:本文中的Sql_exec函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。