Example #1
4
 /**
  * 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);
 }
Example #2
2
 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;
 }
Example #3
0
 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;
 }
Example #4
0
 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');
 }
 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 db_dataseek(&$qhandle,$row)
{
   $i=0;
   while($i<$row)
   {
   		odbc_fetch_row($qhandle);
		$i++;
   }
}
Example #7
0
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>';
    }
}
Example #8
0
 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;
 }
Example #9
0
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>';
    }
}
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;
}
 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;
         }
     }
 }
Example #12
0
 /**
  * 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;
 }
Example #13
0
 /**
  * @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;
 }
Example #14
0
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);
    }
}
Example #15
0
 /**
  * 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++;
     }
 }
 public function GetLoginUser($db, $user)
 {
     try {
         $query = "select Fc_Fullname from tblMember\n\t\t\t\t \twhere Pk_MemberID='" . $user . "'";
         $toprow = odbc_exec($db, $query);
         if (odbc_fetch_row($toprow)) {
             return odbc_result($toprow, "Fc_Fullname");
         }
     } catch (Exception $e) {
         return "";
     }
 }
Example #17
0
function DBGetQuery($result)
{
    // Devuelve la siguiente fila dentro del result-array..
    $arr = array();
    if (odbc_fetch_row($result)) {
        for ($i = 1; $i <= odbc_num_fields($result); $i++) {
            $value = odbc_result($result, $i);
            array_push($arr, $value);
        }
    }
    return $arr;
}
Example #18
0
 /**
  * @see DatabaseInfo::initTables()
  */
 protected function initTables()
 {
     include_once 'creole/drivers/odbc/metadata/ODBCTableInfo.php';
     $result = @odbc_tables($this->conn->getResource());
     if (!$result) {
         throw new SQLException('Could not list tables', $this->conn->nativeError());
     }
     while (odbc_fetch_row($result)) {
         $tablename = strtoupper(odbc_result($result, 'TABLE_NAME'));
         $this->tables[$tablename] = new ODBCTableInfo($this, $tablename);
     }
     @odbc_free_result($result);
 }
Example #19
0
function checkAlreadyId($conn, $sql)
{
    $rs = odbc_exec($conn, $sql);
    if (!$rs) {
        exit("Error in SQL");
    } else {
        $num = odbc_fetch_row($rs);
        if ($num) {
            return "Already-Id";
        } else {
            return "Empty-Id";
        }
    }
    odbc_close($conn);
}
 function afficheTables($pFichAction)
 {
     //remplissage de la liste
     $tablelist = odbc_tables($this->connexion);
     echo '<form name="choixTables" method="get" action="' . $pFichAction . '">';
     echo '<select name="lesTables">';
     while (odbc_fetch_row($tablelist)) {
         if (odbc_result($tablelist, 4) == "TABLE") {
             // Si l'objet en cours a pour indicateur TABLE                //test à ajouter dans la condition pour ne pas afficher les  tables système en Access     && !(substr(odbc_result($tablelist,3),0,4)=="MSys")
             echo '<option value="' . odbc_result($tablelist, 3) . '">' . odbc_result($tablelist, 3) . '</option>';
         }
         // Affiche nom de la TABLE
     }
     echo '</select><input type="submit" value="Afficher"></input></form>';
 }
 public function LoadUserInfo($db)
 {
     try {
         $query = "select Fc_Fullname,Fc_Gender,Fc_Email,Fc_Bday,Fc_PhotoLink from tblMember \n\t\t\t\t\t\twhere Pk_MemberID='" . $this->userID . "'";
         $rows = odbc_exec($db, $query);
         while (odbc_fetch_row($rows)) {
             $user = odbc_result($rows, "Fc_Fullname");
             $sex = odbc_result($rows, "Fc_Gender");
             $email = odbc_result($rows, "Fc_Email");
             $bday = odbc_result($rows, "Fc_Bday");
             $avatar = odbc_result($rows, "Fc_PhotoLink");
             echo "\n\t\t\t\t<table><tr><td>\n\t\t\t\t\t<table style='border-right:1px solid gray;'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><img src='Users/Avatar/" . $avatar . "' alt='no photo'\n\t\t\t\t\t\t\t height='180px' width='180px' style='border-radius:7px;'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><input type='button' name='submit-editphoto' value='Change Photo'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><input type='button' name='submit-changepass' value='Change Password'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table></td><td>\n\t\t\t\t\t<table>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><b style='color:gray;'>Username:</b></td>\n\t\t\t\t\t\t\t<td><input type='text' name='fullname' value='" . $user . "' style='color:teal;'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><b style='color:gray;'>Sex:</b></td>\n\t\t\t\t\t\t\t<td><b style='color:teal;'>" . $sex . "</b></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><b style='color:gray;'>Birthday:</b></td>\n\t\t\t\t\t\t\t<td><b style='color:teal;'>" . $bday . "</b></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><b style='color:gray;'>Email:</b></td>\n\t\t\t\t\t\t\t<td><b style='color:teal;'>" . $email . "</b></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'>\n\t\t\t\t\t\t\t\t<input type='button' name='submit-updateprofile' value='Update Profile'>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table></td></tr>\n\t\t\t\t</table>\n\t\t\t\t";
         }
     } catch (Exception $e) {
     }
 }
Example #22
0
function listeFourni()
{
    global $cnx, $liste;
    $cnx = ouvresylob(1);
    //on selectionne tous les champs qui seront utiles
    $sQuery = "SELECT distinct (f.no_frn) as id, f.rais_soc as raison_sociale, a.nom as contact, f.telph as tel, telex as email, \r\n                        CONCAT(a.adr1,a.adr2) as adresse, CONCAT(a.cd_post,a.ville) as ville\r\n                FROM (informix.bas_frn f \r\n                INNER JOIN informix.bas_adrfrn a ON a.no_frn = f.no_frn) \r\n                LEFT JOIN informix.zz_materiel m ON m.frn_materiel = f.no_frn\r\n                WHERE f.no_frn is not null\r\n                AND a.no_adr = 1\r\n                ORDER BY f.rais_soc asc, a.nom asc";
    //echo $sQuery;
    $res = odbc_exec($cnx, $sQuery);
    $i = 0;
    while (odbc_fetch_row($res)) {
        for ($j = 1; $j <= odbc_num_fields($res); $j++) {
            $liste[$i][odbc_field_name($res, $j)] = odbc_result($res, $j);
        }
        $i++;
    }
    //odbc_close($cnx);
    return $liste;
}
 public function LoadTrails($db)
 {
     $query = "select \n\t\t\t\t\tFk_ID,\n\t\t\t\t\ta.Fc_Fullname,\n\t\t\t\t\tFc_Doing,\n\t\t\t\t\tFc_Desc,\n\t\t\t\t\tFc_Where,\n\t\t\t\t\tFc_TimeStart,\n\t\t\t\t\tpkTrailID,\n\t\t\t\t\tFc_Tag,\n\t\t\t\t\ta.Fc_PhotoLink,\n\t\t\t\t\tb.Fc_PhotoLink as [User_PLink]\n\t\t\t\t\tfrom tblQuickTrail a\n\t\t\t\t\tLEFT JOIN tblMember b on a.Fk_ID = b.Pk_MemberID \n\t\t\t\t\torder by pkTrailID desc";
     $rows = odbc_exec($db, $query);
     while (odbc_fetch_row($rows)) {
         $id = odbc_result($rows, "Fk_ID");
         $user = odbc_result($rows, "Fc_Fullname");
         $d = odbc_result($rows, "Fc_Doing");
         $desc = odbc_result($rows, "Fc_Desc");
         $w = odbc_result($rows, "Fc_Where");
         $t = odbc_result($rows, "Fc_TimeStart");
         $trailID = odbc_result($rows, "pkTrailID");
         $tag = odbc_result($rows, "Fc_Tag");
         $photolink = odbc_result($rows, "Fc_PhotoLink");
         $userphoto = odbc_result($rows, "User_PLink");
         echo "\n\t\t\t<div class='ui-content' style='border-radius:7px;border:1px solid #585899;background-color:white;'>\n\t\t\t\t<div style='background-color:white;padding:2%;border-radius:7px;'>\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<img src='Users/Avatar/" . $userphoto . "' \n\t\t\t\t\t\t\t\t\theight='50px' width='50px' style='border-radius:7px;'>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td><a href='' class='ui-btn'><b style='color:teal;'>" . $user . "</b></a></td>\n\t\t\t\t\t\t\t\t<td><small style='color:gray;'>is " . $this->MiniEvent($photolink) . "</small></td>\n\t\t\t\t\t\t\t\t<td>" . $this->GetEventIcon($d) . "</td>\n\t\t\t\t\t\t\t\t<td id='event'><b>" . $d . "</b></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t<hr>\n\t\t\t\t\t\t" . $this->isPhoto($photolink) . "\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td><span>" . $desc . "</span></td>\n\t\t\t\t\t\t\t\t<td><b style='font-size:large;color:teal;'>" . $tag . "</b></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<small style='color:teal;'>at " . $w . "</small>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<small style='color:gray;'>" . $t . "</small>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t\t<div class='ui-content' id='writecomment'>\n\t\t\t\t\t<form action='Dashboard.php' method='POST'>\n\t\t\t\t\t<input type='hidden' name='trailID' value='" . $trailID . "'>\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<img src='Users/Avatar/" . $_SESSION["userAvatar"] . "' \n\t\t\t\t\t\t\t\theight='30px' width='30px' style='border-radius:7px;'>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<textarea name='comment' placeHolder='say something'></textarea></td><td>\n\t\t\t\t\t\t\t<input type='submit' name='submit-comment' value='add comment'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</form>\n\t\t\t\t</div>\n\t\t\t\t<div id='comments'>\n\t\t\t\t<small>comments</small><img src='images/Comment.png'>\n\t\t\t\t\t<iframe id='frameComments'\n\t\t\t\t\t src='pagelets/LoadComments.php?id=" . $trailID . "' width='100%'\n\t\t\t\t\t onload='resizeIframe(this)' frameborder='0' scrolling='yes'>\n\t\t\t\t\t</iframe>\n\t\t\t\t</div>\n\t\t\t</div><br>";
     }
 }
Example #24
0
 /**
  * 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);
     // grab the number of fields
     // loop over all of the fields
     for ($i = 0; $i < $fieldcount; $i++) {
         // decode each field name ready for encoding when it goes through serialization
         // and save each field name into the array
         $this->columns[] = odbc_field_name($d, $i + 1);
     }
     if (odbc_num_rows($d) > 0) {
         $line = odbc_fetch_row($d, 0);
         do {
             $this->rows[] = $line;
         } while ($line = odbc_fetch_row($d));
     }
 }
 public function Authenticate($user, $pass)
 {
     try {
         $query = "select username,password from tblUser\n\t\t\t\t \twhere username='******'\n\t\t\t\t \t and password='******'";
         $toprow = odbc_exec($this->link, $query);
         if (odbc_fetch_row($toprow)) {
             $u = odbc_result($toprow, "username");
             $p = odbc_result($toprow, "password");
             if ($user == $u && $pass == $p) {
                 return true;
             } else {
                 return false;
             }
         } else {
             return false;
         }
     } catch (Exception $e) {
     }
 }
Example #26
0
function printSearch()
{
    global $search_bar_fields;
    ?>
  <form id="form1" name="form1" method="post" action="index.php">
<?php 
    foreach ($search_bar_fields as $key => $value) {
        echo "<label><b>{$key}</b> <input name=\"{$value}\" type=\"text\" id=\"givenname\" size=\"10\" /></label>  ";
    }
    echo "<strong>Dept</strong> <select name=\"dept\"><option value=\"\"></option>";
    include "../../oit/config/config.php";
    $query = odbc_exec($dbconn, "SELECT DISTINCT dept_name FROM org_chart_depts ORDER BY dept_name");
    for ($i = 1; $i <= odbc_num_rows($query); $i++) {
        odbc_fetch_row($query, $i);
        $dept = odbc_result($query, "dept_name");
        echo "<option value=\"{$dept}\">{$dept}</option>\n";
    }
    echo "</select>";
    ?>
   <label><input name="Search" type="submit" id="Search" value="Search" /></label>
  </form>
<?php 
}
Example #27
0
 function get_report(client $client, $table_name, $show, $rownum)
 {
     if ($table_name == null) {
         return "Bad table name.";
     }
     //TODO check table_name is one word
     //compile query
     $colnames = odbc_exec($client->get_connection(), "SELECT column_name, data_type, data_length FROM ALL_TAB_COLUMNS WHERE table_name = '" . strtoupper($table_name) . "';");
     if ($colnames === false) {
         return "Unable to get table fields.";
     }
     $query = "SELECT ";
     $i = 0;
     while (odbc_fetch_row($colnames)) {
         if (isset($show) && isset($show[$i]) && $show[$i] == true) {
             if ($query != "SELECT ") {
                 $query .= ", ";
             }
             $query .= odbc_result($colnames, 1);
         }
         $i += 1;
     }
     $query .= " FROM " . $table_name . " WHERE rownum <= ?;";
     //prepare statement
     $statement = odbc_prepare($client->get_connection(), $query);
     if ($statement === false) {
         return $query . "\n\n" . get_odbc_error();
     }
     $items = array();
     $items[] = (int) $rownum;
     $result = odbc_execute($statement, $items);
     if ($result === false) {
         return $query . "\n\n" . get_odbc_error();
     }
     return $statement;
 }
//53
echo "\t";
//54
echo "\t";
//55
echo "\t";
//56
echo "\t";
//57
echo "\t";
//58
echo "\t";
//59
odbc_close($connection_string);
$process2 = odbc_exec($connection_string2, "Exec usp_USI_getReferralProcedures '" . $_GET['pReferral_ud'] . "'");
while (odbc_fetch_row($process2)) {
    echo odbc_result($process2, "procedurecode_ud") . "\t";
    // 60,70,80,90,100,110
    echo odbc_result($process2, "description") . "\t";
    // 61,71,81,91,101,111
    echo round(odbc_result($process2, "average_cost")) . "\t";
    // 62,72,82,92,102,112
    // Spare fields for later use
    echo odbc_result($process2, "modifier_1") . "\t";
    // 63,73,83,93,103,113
    echo "\t";
    // 64,74,84,94,104,114
    echo "\t";
    // 65,75,85,95,105,115
    echo "\t";
    // 66,76,86,96,106,116
Example #29
0
 /**
  * Fetches the row at current position and moves the internal cursor to the next position.
  * @param  bool     TRUE for associative array, FALSE for numeric
  * @return array    array on success, nonarray if no next record
  * @internal
  */
 public function fetch($assoc)
 {
     if ($assoc) {
         return odbc_fetch_array($this->resultSet, ++$this->row);
     } else {
         $set = $this->resultSet;
         if (!odbc_fetch_row($set, ++$this->row)) {
             return FALSE;
         }
         $count = odbc_num_fields($set);
         $cols = array();
         for ($i = 1; $i <= $count; $i++) {
             $cols[] = odbc_result($set, $i);
         }
         return $cols;
     }
 }
Example #30
0
<?php

include "php/configModeler.php";
global $DB;
$DB = str_replace("\"", "", $DB);
$connection_string = odbc_connect($DB, "", "");
$q = "exec usp_getAvgRates_With_Medicare_And_Rev '861,818,3337,599', '74178', '2011'";
$pr = odbc_exec($connection_string, $q);
while (odbc_fetch_row($pr)) {
    echo odbc_result($pr, "Description") . "<BR>";
    echo odbc_result($pr, "AvgRate") . "<BR>";
    echo odbc_result($pr, "MinRate") . "<BR>";
    echo odbc_result($pr, "MaxRate") . "<BR>";
}
?>