โดย boy1999 » 28/11/2007 10:28 pm
<?php
define ("login", "");
define ("pwd", "");
define ("host", "ARCGLOBE");
define ("db","GIS");
class Operation
{
var $_conn;
var $fields;
var $numrows;
function OracleOperation ()
{
$this->createConnection();
}
function createConnection()
{
//$this->_conn = OCILogon(login, pwd, host);
$link = @mssql_connect(host,login, pwd) or die("äÁèÊÒÁÒöàª×èÍÁµèÍ°Ò¹¢éÍÁÙÅä´é");;
$this->_conn = @mssql_select_db(db,$link) or die("°Ò¹¢éÍÁÙÅäÁè¶Ù¡µéͧ");;
}
function selectQuery($sql)
{
$this->createConnection();
//$stmt = OCIParse($this->_conn, $sql);
@mssql_query("set names 'tis620'");
//OCIExecute($stmt, OCI_DEFAULT);
$data = @mssql_query($sql);
$i = 0;
$this->numrows = @mssql_num_rows($data);
//while(OCIFetchInto ($stmt, $row, OCI_ASSOC))
while($i < $this->numrows)
{
//$this->fields[$i] = $row;
$this->fields[$i] = @mssql_fetch_assoc($data);
$i++;
}
//$this->numrows = $i;
return $data;
}
function sendQuery($sql)
{
$this->createConnection();
//echo $sql;
@mssql_query($sql);
//$stmt = OCIParse($this->_conn, $sql);
if(@msql_affected_rows() != -1){
return true;
}else{
return false;
}
}
}
<?php
define ("login", "");
define ("pwd", "");
define ("host", "ARCGLOBE");
define ("db","GIS");
class Operation
{
var $_conn;
var $fields;
var $numrows;
function OracleOperation ()
{
$this->createConnection();
}
function createConnection()
{
//$this->_conn = OCILogon(login, pwd, host);
$link = @mssql_connect(host,login, pwd) or die("äÁèÊÒÁÒöàª×èÍÁµèÍ°Ò¹¢éÍÁÙÅä´é");;
$this->_conn = @mssql_select_db(db,$link) or die("°Ò¹¢éÍÁÙÅäÁè¶Ù¡µéͧ");;
}
function selectQuery($sql)
{
$this->createConnection();
//$stmt = OCIParse($this->_conn, $sql);
@mssql_query("set names 'tis620'");
//OCIExecute($stmt, OCI_DEFAULT);
$data = @mssql_query($sql);
$i = 0;
$this->numrows = @mssql_num_rows($data);
//while(OCIFetchInto ($stmt, $row, OCI_ASSOC))
while($i < $this->numrows)
{
//$this->fields[$i] = $row;
$this->fields[$i] = @mssql_fetch_assoc($data);
$i++;
}
//$this->numrows = $i;
return $data;
}
function sendQuery($sql)
{
$this->createConnection();
//echo $sql;
@mssql_query($sql);
//$stmt = OCIParse($this->_conn, $sql);
if(@msql_affected_rows() != -1){
return true;
}else{
return false;
}
}
}