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; }
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"; }
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"; }
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; } }
public function exec($query, $security = NULL) { if (empty($query)) { return false; } return odbc_exec($this->connect, $query); }
public function db($query) { $connect = odbc_connect("SIT", "palagi01", "s1mple01"); $result = odbc_exec($connect, $query); return $result; #odbc_close($connect); }
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; } } }
/** * * @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; }
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 = '******'"; $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 = '******' WHERE User_Name = '" . $userName . "'"; $rs = odbc_exec($conn, $sql); } return "OK"; }
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; } }
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; }
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"; }
/** * 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; }
public function Query($sql) { $rs = odbc_exec($this->db_link, $sql); while ($row = odbc_fetch_array($rs)) { $rows[] = $row; } return $rows; }
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 }
function DeletarProduto($idProduto) { $con = odbc_connect("DRIVER={SQL Server}; SERVER=i9yueekhr9.database.windows.net;\n\t\tDATABASE=lotus;", "TSI", "SistemasInternet123"); //$SQL = 'SELECT COUNT(*) AS QTD FROM ESTOQUE WHERE IDPRODUTO='.$idProduto; $SQL = 'delete from produto where idproduto = ' . $idProduto; echo "PRODUTO EXCLUIDO COM SUCESSO"; odbc_exec($con, $SQL); }
function db_exec($qstring,$conn) { global $strLastSQL,$dDebug; if ($dDebug===true) echo $qstring."<br>"; $strLastSQL=$qstring; return odbc_exec($conn,$qstring); }
public function clienteDebug() { $sth = odbc_exec($this->objOdbc, "SELECT CLIE, NOME, CGC FROM SIF01D WHERE CLIE = 1044"); while ($data[] = odbc_fetch_array($sth)) { } $this->Close(); array_pop($data); return $data; }
/** * @param $query string query to execute * @return resource results or FALSE */ public function executeQuery($query) { if (!$this->isConnected()) { return false; } $ress = null; $ress = @odbc_exec($this->connection, $query); return $ress; }
public function Remove() { $conn = parent::GetConnection(); $query = $this->SetupQuery(Query::REMOVE_WALKING_TASK); if (!odbc_exec($conn, $query)) { return false; } return parent::Remove(); }
function DBExecSql($connection, $sql) { // Ejecuta el select pasado como parĂ¡metro.. $results = odbc_exec($connection, $sql); if (!$results) { throw new Exception("Error en la consulta."); } return $results; }
public function exec_sql($sql, $line, $file, $function, $class, $link) { return odbc_exec($link, "SET NAMES 'utf8'"); $this->c_sql = $sql; // !!! Attention bien laisser $this->resultat, ne pas retourner directement mysql_query cela ne fonctionne pas !!! // $this->c_resultat = mysql_query($sql,$link) or die(mysql_error().' '.$sql);//or $this->die_sql($sql,$line,$file,$function,$class,$link,round(microtime(true) - $start_hour,6)); $this->c_resultat = odbc_exec($link, $sql) or $this->die_sql($sql, $line, $file, $function, $class); return $this->c_resultat; }
function exec($query) { $this->error = 0; $this->result = odbc_exec($this->conn, $query) or $this->error = 1; if ($this->error == 1) { $this->err_no = -1; $this->err_msg = ""; } }
public function getKOSUserByCharacter($chr_uid, $con) { $sql = "select * from dbo.chr_info where chr_uid = {$chr_uid}"; $result = odbc_exec($con, $sql); while (odbc_fetch_row($result)) { $return = array('UserId' => odbc_result($result, "chr_uin")); } return $return; }
function &_doQuery($queryString) { if ($qI = odbc_exec($this->_connection, $queryString)) { $rs =& new CopixDbResultSetODBCSQLServer($qI); } else { $rs = false; } return $rs; }
public function getCount($sql, $row = 0, $field = null) { $query = odbc_exec($this->dbConnection(), $sql); if ($query) { $result = odbc_result($query, $row, $field); return $result; } else { $this->halt('Database query error', $sql); } }
function isAvailable($conn, $id) { $req = 'SELECT ESTDISPONIBLE FROM appartement WHERE IDAPPARTEMENT=' . $id; $res = odbc_exec($conn, $req); if (odbc_result($res, 1)) { return true; } else { return false; } }
/** * */ function CreateNew($p) { try { $query = "insert into tblUser(fcCompany,fcEmail,fcTelephone,fcDateRegister,fbActive,fcLastname,fcFirstname)\n\t\t\tvalues('" . $p["company"] . "','" . $p["email"] . "','" . $p["telephone"] . "',GETDATE(),0,'" . $p["lastname"] . "','" . $p["firstname"] . "')"; odbc_exec($this->link, $query); return "<div class='alert alert-success'>Success! Please check your email for verification.</div>"; } catch (Exception $e) { return "<div class='alert alert-warning'>Something went wrong!</div>"; } }
/** * Execute a query and returns an ODBC result identifier * @param string $query * @return resource * @throws Exception */ protected function executeQuery($query) { $res = @odbc_exec($this->_lnk, $query); if (!$res) { $error = odbc_errormsg($this->_lnk); $this->log('Query failed: ' . $error); throw new Exception('Executing query failed ' . $error, self::QUERY_FAILED); } return $res; }
public static function addAdress($conn, $idville, $numrue, $nomrue) { $requete = odbc_exec($conn, "INSERT INTO dbo.adresse (IDVILLE,NUMRUE,NOMRUE) VALUES ({$idville},{$numrue},'{$nomrue}');"); $result = odbc_exec($conn, "SELECT @" . "@IDENTITY AS Ident"); return $result; odbc_close($conn); }