本文整理汇总了PHP中odbc_exec函数的典型用法代码示例。如果您正苦于以下问题:PHP odbc_exec函数的具体用法?PHP odbc_exec怎么用?PHP odbc_exec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了odbc_exec函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_json_data
public function get_json_data()
{
$lista = json_decode($this->field_list);
$base = $this->db->getDB();
$this->conn = odbc_connect("DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ={$base}", '', '') or exit('Cannot open with driver.');
if (!$this->conn) {
exit("Connection Failed: " . $this->conn);
}
$rs = odbc_exec($this->conn, $this->sql);
if (!$rs) {
exit("Error in SQL");
}
$value = '[';
while (odbc_fetch_row($rs)) {
$value .= '[';
foreach ($lista as $valor) {
$value .= $this->not_null(odbc_result($rs, $valor[0]), $valor[1]) . ',';
}
$value .= '],';
}
$value .= ']';
$value = str_replace(",]", "]", $value);
odbc_close_all();
//$value = utf8_encode($value);
return $value;
}
示例2: ImportData
function ImportData($objOdbc, $objMySql, $strTableName)
{
global $objMySql;
$objMySql->query("TRUNCATE `" . strtolower($strTableName) . '`;');
$objResult = odbc_exec($objOdbc, "SELECT * FROM " . $strTableName . ";");
print "Migrating " . odbc_num_rows($objResult) . " rows of data for " . $strTableName . "... [0]";
$intCount = 0;
while ($arrResult = odbc_fetch_array($objResult)) {
print str_repeat(chr(8), strlen($intCount) + 1);
$intCount++;
print $intCount . ']';
$strColumns = 'pkid';
$strValues = 'NULL';
foreach ($arrResult as $strKey => $strValue) {
$strColumns .= ', `' . strtolower($strKey) . '`';
if (strlen($strValue)) {
$strValues .= ", '" . $objMySql->escape_string($strValue) . "'";
} else {
$strValues .= ', NULL';
}
}
$strSql = sprintf('INSERT INTO `%s` VALUES (%s);', strtolower($strTableName), $strValues);
$objMySql->query($strSql);
}
print " Done.\r\n";
}
示例3: InsereProduto
function InsereProduto($NomeProduto, $descProduto, $precProduto, $descontoProduto, $idCategoria, $ativoProduto, $idUsuario, $qtdMinEstoque)
{
$con = odbc_connect("DRIVER={SQL Server}; SERVER=i9yueekhr9.database.windows.net;\n\t\tDATABASE=lotus;", "TSI", "SistemasInternet123");
$SQL = "insert into produto(nomeProduto, descProduto, precProduto, descontoPromocao, idCategoria, ativoProduto, idUsuario, qtdMinEstoque, imagem)\n\t\tvalues('" . $NomeProduto . "', '" . $descProduto . "', " . $precProduto . ", \n\t\t\t" . $descontoProduto . ", " . $idCategoria . ", " . $ativoProduto . ", " . $idUsuario . ", " . $qtdMinEstoque . ", null)";
odbc_exec($con, $SQL);
echo "PRODUTO INSERIDO COM SUCESSO";
}
示例4: SaveNewAccount
public function SaveNewAccount($db)
{
$query = "insert into tblMember(Fc_Fullname,Fc_Gender,Fc_Email,Fc_Bday,Fc_Password,Fc_PhotoLink)\n\t\t\t\t\tVALUES('" . $this->fullname . "','" . $this->sex . "','" . $this->email . "'\n\t\t\t\t\t\t,'" . $this->bday . "','" . $this->pass . "','default.jpg')";
if (odbc_exec($db, $query)) {
return true;
}
}
示例5: exec
public function exec($query, $security = NULL)
{
if (empty($query)) {
return false;
}
return odbc_exec($this->connect, $query);
}
示例6: db
public function db($query)
{
$connect = odbc_connect("SIT", "palagi01", "s1mple01");
$result = odbc_exec($connect, $query);
return $result;
#odbc_close($connect);
}
示例7: sql_result
function sql_result($query, $conn = NULL)
{
if (DATABASE == "mysql") {
if (is_null($conn)) {
$qryRslt = @mysql_query($query, $GLOBALS["db_con"]);
} else {
$qryRslt = @mysql_query($query, $conn);
}
if (!$qryRslt) {
echo $query;
error_log(date("F j, Y, g:i a") . "\t{$query}\n" . $_SERVER["PATH_INFO"] . "\n\t" . @mysql_error() . "\n\n", 3, "sql_error.log");
die("<br><font color=\"red\">Due to some technical problem, your Transaction was <b>NOT</b> successful</font>\n");
}
return $qryRslt;
} else {
if (DATABASE == "odbc") {
if (is_null($conn)) {
$qryRslt = @odbc_exec($GLOBALS["db_con"], $query);
} else {
$qryRslt = @odbc_exec($conn, $query);
}
if (!$qryRslt) {
error_log(date("F j, Y, g:i a") . "\t{$query}\n" . $_SERVER["PATH_INFO"] . "\n\t" . @odbc_error() . "\n\n", 3, "sql_error.log");
die("<br><font color=\"red\">Due to some technical problem, your Transaction was <b>NOT</b> successful</font>\n");
}
return $qryRslt;
}
}
}
示例8: execute
/**
*
* @param type $query
* @param type $type
* @return type
*/
public function execute($query, $type = null)
{
$result = array();
switch ($this->db_engine) {
case "pgsql":
$resultado = pg_query($this->conn, $query);
while ($row = pg_fetch_row($resultado)) {
$result[] = $row;
}
pg_close($this->conn);
break;
case "mssql":
$resultado = odbc_exec($this->conn, $query);
while ($row = odbc_fetch_array($resultado)) {
$result[] = $row;
}
break;
case "mysql":
$result = array();
$resultado = mysql_query($query);
if (gettype($resultado) == "boolean") {
$result = $resultado;
} else {
while ($row = mysql_fetch_row($resultado)) {
$result[] = $row;
}
}
mysql_close($this->conn);
break;
}
return $result;
}
示例9: changeUserPassword
public function changeUserPassword($userName, $userOldPassword, $userNewPassword, $portalID)
{
VDSN;
$conn = odbc_connect(VDSN, USER, PW) or die('ODBC Error:: ' . odbc_error() . ' :: ' . odbc_errormsg() . ' :: ' . VDSN);
//test for user name
if ($conn) {
$sql = "SELECT '1' outputFlag FROM Portal_User WHERE User_Name = '" . $userName . "' AND Portal_ID = '" . $portalID . "'";
$rs = odbc_exec($conn, $sql);
$row = odbc_fetch_row($rs);
if ($row == null) {
odbc_close($conn);
return "You have entered an invalid user name; please try again.";
}
}
//test for password
if ($conn) {
$sql = "SELECT '1' FROM Users WHERE User_Name = '" . $userName . "' AND User_Password = '" . $userOldPassword . "'";
$rs = odbc_exec($conn, $sql);
$row = odbc_fetch_row($rs);
if ($row == null) {
odbc_close($conn);
return "You have entered an invalid password for your account; please try again.";
}
}
//save new password
if ($conn) {
$sql = "UPDATE Users SET User_Password = '" . $userNewPassword . "' WHERE User_Name = '" . $userName . "'";
$rs = odbc_exec($conn, $sql);
}
return "OK";
}
示例10: doquery
function doquery($query, $table, $fetch = false)
{
global $link, $debug, $ugamela_root_path;
@(include $ugamela_root_path . 'config.php');
if (!$link) {
$link = odbc_connect($dbsettings["server"], $dbsettings["user"], $dbsettings["pass"]) or $debug->error(odbc_error() . "<br />{$query}", "SQL Error");
//message(mysql_error()."<br />$query","SQL Error");
odbc_select_db($dbsettings["name"]) or $debug->error(odbc_error() . "<br />{$query}", "SQL Error");
}
// por el momento $query se mostrara
// pero luego solo se vera en modo debug
$sqlquery = odbc_exec($query, str_replace("{{table}}", $dbsettings["prefix"] . $table)) or $debug->error(odbc_error() . "<br />{$query}", "SQL Error");
//message(mysql_error()."<br />$query","SQL Error");
unset($dbsettings);
//se borra la array para liberar algo de memoria
global $numqueries, $debug;
//,$depurerwrote003;
$numqueries++;
//$depurerwrote003 .= ;
$debug->add("<tr><th>Query {$numqueries}: </th><th>{$query}</th><th>{$table}</th><th>{$fetch}</th></tr>");
if ($fetch) {
//hace el fetch y regresa $sqlrow
$sqlrow = odbc_fetch_array($sqlquery);
return $sqlrow;
} else {
//devuelve el $sqlquery ("sin fetch")
return $sqlquery;
}
}
示例11: ExecSQL
function ExecSQL($sql)
{
// echo "ExecSQL" . $sql . "<br>" ;
$res = odbc_exec($this->sce, $sql);
// if (! $res) echo "Bad Exec SQL " . htmlspecialchars($sql) . "<br>" ; //zzzzz
return $res ? true : false;
}
示例12: head_cus
function head_cus($customer_no)
{
$link = Fconectar();
if ($link) {
// Se define la consulta que va a ejecutarse, como en sql
$sql_datos_cus = "\n\t\t\t\t\tSELECT C.par_cus_no, C.cus_no, C.cus_name, V1.slspsn_name AS Vendedor, V2.slspsn_name AS Cobrador, C.ar_terms_cd \n\t\t\t\t\tFROM\n\t\t\t\t\tARCUSFIL_SQL AS C,\n\t\t\t\t\tARSLMFIL_SQL AS V1,\n\t\t\t\t\tARSLMFIL_SQL AS V2\n\t\t\t\t\tWHERE\n\t\t\t\t\tC.slspsn_no = V1.slspsn_no AND\n\t\t\t\t\tC.collector = V2.slspsn_no AND\n\t\t\t\t\tC.cus_no = '{$customer_no}'\n\t\t\t\t";
// Se ejecuta la consulta y se guardan los resultados
$results = odbc_exec($link, $sql_datos_cus) or die("Error en instruccion SQL {$sql_datos_cus}");
$existe = odbc_num_rows($results);
if ($existe) {
$registro = odbc_fetch_array($results);
$head_cus_no = $registro['cus_no'];
$head_cus_name = $registro['cus_name'];
$head_ar_terms_cd = $registro['ar_terms_cd'];
$head_slspsn_name = $registro['Vendedor'];
$head_collector = $registro['Cobrador'];
} else {
$mensaje = "No existen registros!";
}
} else {
Ferror("No se pudo establecer coneccion con la Base de Datos!");
}
// Se cierra la conexión
odbc_close($link);
echo "\n\t\t<div align='center'>\n\t\t<table width='40%' border='3' cellpadding='0' cellspacing='10' bordercolor='#DCF3A4' align='center'>\n\t\t\t<th colspan='2'>EDADES DE CARTERA POR CLIENTE (Datos hasta: " . date('d-m-Y') . ")</th>\t\n\t\t\t<tr>\n\t\t\t\t<td>Cliente:</td>\n\t\t\t\t<td>(" . number_format($head_cus_no, 0, '', '') . ") - {$head_cus_name}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>Vendedor:</td>\n\t\t\t\t<td>{$head_slspsn_name}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>Cobrador:</td>\n\t\t\t\t<td>{$head_collector}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>Condición de Pago:</td>\n\t\t\t\t<td>{$head_ar_terms_cd}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' align='center'>Generado: " . date('d-m-Y H:i:s') . "</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</div>\n\t\t";
}
示例13: query
/**
* Enter description here...
*
* @param unknown_type $query
*
* @return unknown
*/
public static function query($query)
{
if (!($var = \odbc_exec(self::$conn, $query))) {
throw new DBException('(' . $query . ') had an error: ' . \odbc_errormsg());
}
return $var;
}
示例14: Query
public function Query($sql)
{
$rs = odbc_exec($this->db_link, $sql);
while ($row = odbc_fetch_array($rs)) {
$rows[] = $row;
}
return $rows;
}
示例15: DBODBCRows
function DBODBCRows($conn, $sql)
{
$this->res = odbc_exec($conn, $sql);
if (!$this->res) {
echo "zzz Bad DBODBCRows with SQL:" . $sql;
}
//echo "zzz SQL:" . $sql ;//zzz
}