本文整理汇总了PHP中odbc_fetch_row函数的典型用法代码示例。如果您正苦于以下问题:PHP odbc_fetch_row函数的具体用法?PHP odbc_fetch_row怎么用?PHP odbc_fetch_row使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了odbc_fetch_row函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: odbcAdapter
/**
* Constructor method for the adapter. This constructor implements the setting of the
* 3 required properties for the object.
*
* The body of this method was provided by Mario Falomir... Thanks.
*
* @param resource $d The datasource resource
*/
function odbcAdapter($d)
{
parent::RecordSetAdapter($d);
// count number of fields
$fieldcount = odbc_num_fields($d);
$ob = "";
$be = $this->isBigEndian;
$fc = pack('N', $fieldcount);
if (odbc_num_rows($d) > 0) {
$line = odbc_fetch_row($d, 0);
do {
// write all of the array elements
$ob .= "\n" . $fc;
for ($i = 1; $i <= $fieldcount; $i++) {
// write all of the array elements
$value = odbc_result($d, $i);
if (is_string($value)) {
// type as string
$os = $this->_directCharsetHandler->transliterate($value);
//string flag, string length, and string
$len = strlen($os);
if ($len < 65536) {
$ob .= "" . pack('n', $len) . $os;
} else {
$ob .= "\f" . pack('N', $len) . $os;
}
} elseif (is_float($value) || is_int($value)) {
// type as double
$b = pack('d', $value);
// pack the bytes
if ($be) {
// if we are a big-endian processor
$r = strrev($b);
} else {
// add the bytes to the output
$r = $b;
}
$ob .= "" . $r;
} elseif (is_bool($value)) {
//type as bool
$ob .= "";
$ob .= pack('c', $value);
} elseif (is_null($value)) {
// null
$ob .= "";
}
}
} while ($line = odbc_fetch_row($d));
}
$this->serializedData = $ob;
// grab the number of fields
// loop over all of the fields
for ($i = 1; $i <= $fieldcount; $i++) {
// decode each field name ready for encoding when it goes through serialization
// and save each field name into the array
$this->columnNames[$i - 1] = $this->_directCharsetHandler->transliterate(odbc_field_name($d, $i));
}
$this->numRows = odbc_num_rows($d);
}
示例2: 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;
}
示例3: execAsJson
public function execAsJson($query, $logComponent)
{
$query = 'sparql define output:format "RDF/XML" ' . $query;
/*
$query= 'sparql define output:format "TTL" ' .$query;
*/
/*
echo $query;
die;
*/
$odbc_result = $this->exec($query, $logComponent);
odbc_longreadlen($odbc_result, ODBC_MAX_LONGREAD_LENGTH);
odbc_fetch_row($odbc_result);
$data = false;
do {
$temp = odbc_result($odbc_result, 1);
if ($temp != null) {
$data .= $temp;
}
} while ($temp != null);
//=$data;
$conv = new XmlConverter();
$arr = $conv->toArray($data);
//print_r($arr);
//die;
//Logger::warn('check if faster with default graph, ');
return $arr;
}
示例4: Table
function Table($sql, $col)
{
global $conn;
//Query
$res = odbc_do($conn, $sql);
if (!$res) {
die('SQL error');
}
//Header
$this->SetFillColor(255, 0, 0);
$this->SetTextColor(255);
$this->SetDrawColor(128, 0, 0);
$this->SetLineWidth(0.3);
$this->SetFont('', 'B');
$tw = 0;
foreach ($col as $label => $width) {
$tw += $width;
$this->Cell($width, 7, $label, 1, 0, 'C', 1);
}
$this->Ln();
//Rows
$this->SetFillColor(224, 235, 255);
$this->SetTextColor(0);
$this->SetFont('');
$fill = false;
while (odbc_fetch_row($res)) {
foreach ($col as $field => $width) {
$this->Cell($width, 6, odbc_result($res, $field), 'LR', 0, 'L', $fill);
}
$this->Ln();
$fill = !$fill;
}
$this->Cell($tw, 0, '', 'T');
}
示例5: 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";
}
示例6: db_dataseek
function db_dataseek(&$qhandle,$row)
{
$i=0;
while($i<$row)
{
odbc_fetch_row($qhandle);
$i++;
}
}
示例7: ddlVille
function ddlVille($conn)
{
$result = odbc_exec($conn, "SELECT IDVILLE, NOMVILLE from ville;");
while (odbc_fetch_row($result)) {
$nomville = odbc_result($result, 2);
$id = odbc_result($result, 1);
echo '<option value=' . $id . '>' . $nomville . '</option>';
}
}
示例8: getKOSUserByCharacter
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;
}
示例9: ddlPlage2
function ddlPlage2($conn, $id)
{
$req = "SELECT plage.IDPLAGE, PLAGE \n FROM plage WHERE plage.IDPLAGE BETWEEN 25 AND 32 AND IDPLAGE NOT IN (SELECT IDPLAGE FROM paiement\n INNER JOIN contratlocation ON paiement.IDCONTRAT = contratlocation.IDCONTRAT\n WHERE IDAPPARTEMENT=" . $id . ");";
$result = odbc_exec($conn, $req);
while (odbc_fetch_row($result)) {
$plage = odbc_result($result, 2);
$id = odbc_result($result, 1);
echo '<option value=' . $id . '>' . $plage . '</option>';
}
}
示例10: db_gettablelist
function db_gettablelist()
{
global $conn;
$ret=array();
$rs = odbc_tables($conn);
while(odbc_fetch_row($rs))
if(odbc_result($rs,"TABLE_TYPE")=="TABLE" || odbc_result($rs,"TABLE_TYPE")=="VIEW")
$ret[]=odbc_result($rs,"TABLE_NAME");
return $ret;
}
示例11: CheckEmailIfExists
public function CheckEmailIfExists($db)
{
$query = "select Fc_Email from tblMember";
$rows = odbc_exec($db, $query);
while (odbc_fetch_row($rows)) {
$existing = odbc_result($rows, "Fc_Email");
if ($this->email == $existing) {
return true;
}
}
}
示例12: numero_filas
/**
* Devuelve la cantidad de filas de un resultado de query
*
* @access public
* @param (object) result set
* @return (int) cantidad de filas en el resulta set
*/
function numero_filas($rs)
{
// Fix para odbc_num_rows que siempre devuelve -1 para MS Access
$count = 0;
while ($temp = odbc_fetch_into($rs, $counter)) {
$count++;
}
// Reset cursor position
odbc_fetch_row($rs, 0);
return $count;
}
示例13: db_gettablelist
/**
* @return Array
*/
public function db_gettablelist()
{
$ret = array();
$rs = odbc_tables($this->connectionObj->conn);
while (odbc_fetch_row($rs)) {
if (odbc_result($rs, "TABLE_TYPE") == "TABLE" || odbc_result($rs, "TABLE_TYPE") == "VIEW") {
$ret[] = odbc_result($rs, "TABLE_NAME");
}
}
return $ret;
}
示例14: db_fetch_row
function db_fetch_row($res)
{
switch (DATABASE) {
case 'mysql':
return mysql_fetch_row($res);
case 'mysqli':
return mysqli_fetch_row($res);
case 'sqlserver':
return odbc_fetch_row($res);
}
}
示例15: result_access
/**
* access不支持limit,所以自写方法完成
* 获取所有记录
* odbc_fetch_row 让游标偏移 $offset
*
* @param int $offset 游标偏移量
* @param int $pagesize 查询的结果行数
* @return array
*/
function result_access($offset, $pagesize = 0)
{
odbc_fetch_row($this->result_id, $offset);
$i = 1;
while ($row = $this->_fetch_assoc()) {
if ($i <= $pagesize) {
$this->result_array[] = $row;
}
$i++;
}
}