本文整理汇总了PHP中ifx_connect函数的典型用法代码示例。如果您正苦于以下问题:PHP ifx_connect函数的具体用法?PHP ifx_connect怎么用?PHP ifx_connect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ifx_connect函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _connect
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
{
$dbs = $argDatabasename . "@" . $argHostname;
$this->_connectionID = ifx_connect($dbs, $argUsername, $argPassword);
if ($this->_connectionID === false) {
return false;
}
#if ($argDatabasename) return $this->SelectDB($argDatabasename);
return true;
}
示例2: connect
/**
* Open a connection to db
*/
public function connect()
{
$this->conn = ifx_connect($this->dbname . "@" . $this->host, $this->user, $this->pwd);
if (!$this->conn) {
trigger_error(ifx_errormsg(), E_USER_ERROR);
}
ifx_blobinfile_mode(0);
ifx_textasvarchar(1);
ifx_byteasvarchar(1);
return $this->conn;
}
示例3: db_connect
function db_connect($oArray)
{
$db = $oArray[3] . '@' . $oArray[2];
list($sUser, $sHome, $sConfig) = split(':', $oArray[0]);
putenv("INFORMIXDIR={$sHome}");
putenv("INFORMIXSERVER={$oArray['2']}");
putenv("ONCONFIG={$sConfig}");
$oCon = @ifx_connect($db, $sUser, $oArray[1]);
if (!$oCon) {
die("could not connect");
}
return $oCon;
}
示例4: _connect
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
{
if (!function_exists('ifx_connect')) {
return null;
}
$dbs = $argDatabasename . "@" . $argHostname;
if ($argHostname) {
putenv("INFORMIXSERVER={$argHostname}");
}
putenv("INFORMIXSERVER=" . trim($argHostname));
$this->_connectionID = ifx_connect($dbs, $argUsername, $argPassword);
if ($this->_connectionID === false) {
return false;
}
#if ($argDatabasename) return $this->SelectDB($argDatabasename);
return true;
}
示例5: connect
/**
* Hace una conexión a la base de datos de Informix
*
* @param array $config
* @return resource_connection
*/
public function connect($config)
{
if (!extension_loaded('informix')) {
throw new KumbiaException('Debe cargar la extensión de PHP llamada php_ifx');
}
if ($this->id_connection = ifx_connect("{$config['name']}@{$config['host']}", $config['username'], $config['password'])) {
return true;
} else {
throw new KumbiaException($this->error());
}
}
示例6: otherdb
//.........这里部分代码省略.........
$ifxquery = isset($_POST['ifxsql']) ? $_POST['ifxsql'] : '';
$ifxquery = stripslashes($ifxquery);
print <<<END
<form method="POST" name="ifxform" action="?s=gg&db=ifx">
<div class="actall">Dbname:<input type="text" name="ifxhost" value="{$ifxdbname}" style="width:100px">
User:<input type="text" name="ifxuser" value="{$ifxuser}" style="width:100px">
Pass:<input type="text" name="ifxpass" value="{$ifxpass}" style="width:100px"><br>
<script language="javascript">
function ifxFull(i){
Str = new Array(11);
\tStr[0] = "";
\tStr[1] = "select dbservername from sysobjects;";
\tStr[2] = "select name from sysdatabases;";
\tStr[3] = "select tabname from systables;";
\tStr[4] = "select colname from syscolumns where tabid=n;";
\tStr[5] = "select username,usertype,password from sysusers;";
\tifxform.ifxsql.value = Str[i];
\treturn true;
}
</script>
<textarea name="ifxsql" style="width:600px;height:200px;">{$ifxquery}</textarea><br>
<select onchange="return ifxFull(options[selectedIndex].value)">
\t<option value="0" selected>ִ������</option>
\t<option value="1">���ݿ�����������</option>
\t<option value="1">���ݿ�</option>
\t<option value="2">����</option>
\t<option value="3">�ֶ�</option>
\t<option value="4">hashes</option>
</select>
<input type="hidden" name="action" value="ifxquery">
<input class="bt" type="submit" value="Query"></div></form>
END;
if ($ifxaction == 'ifxquery') {
$ifxlink = ifx_connect($ifcdbname, $ifxuser, $ifxpass) or die(ifx_errormsg());
$ifxresult = ifx_query($ifxquery, $ifxlink) or die(ifx_errormsg());
$ifxrow = ifx_fetch_row($ifxresult);
echo '<font face="verdana"><table border="1" cellpadding="1" cellspacing="2">' . "\n<tr>\n";
for ($i = 0; $i < ifx_num_fields($ifxresult); $i++) {
echo '<td><b>' . ifx_fieldproperties($ifxresult) . "</b></td>\n";
}
echo "</tr>\n";
mysql_data_seek($ifxresult, 0);
while ($ifxrow = ifx_fetch_row($ifxresult)) {
echo "<tr>\n";
for ($i = 0; $i < ifx_num_fields($ifxresult); $i++) {
echo '<td>' . "{$ifxrow[$i]}" . '</td>';
}
echo "</tr>\n";
}
echo "</table></font>";
ifx_free_result($ifxresult);
ifx_close();
}
} elseif ($db == "db2") {
$db2host = isset($_POST['db2host']) ? $_POST['db2host'] : 'localhost';
$db2port = isset($_POST['db2port']) ? $_POST['db2port'] : '50000';
$db2user = isset($_POST['db2user']) ? $_POST['db2user'] : 'root';
$db2pass = isset($_POST['db2pass']) ? $_POST['db2pass'] : '123456';
$db2dbname = isset($_POST['db2dbname']) ? $_POST['db2dbname'] : 'mysql';
$db2action = isset($_POST['action']) ? $_POST['action'] : '';
$db2query = isset($_POST['db2sql']) ? $_POST['db2sql'] : '';
$db2query = stripslashes($db2query);
print <<<END
<form method="POST" name="db2form" action="?s=gg&db=db2">
<div class="actall">Host:<input type="text" name="db2host" value="{$db2host}" style="width:100px">
Port:<input type="text" name="db2port" value="{$db2port}" style="width:60px">
示例7: otherdb
//.........这里部分代码省略.........
$ifxquery = isset($_POST['ifxsql']) ? $_POST['ifxsql'] : '';
$ifxquery = stripslashes($ifxquery);
print <<<END
<form method="POST" name="ifxform" action="?s=w&db=ifx">
<div class="actall">Dbname:<input type="text" name="ifxhost" value="{$ifxdbname}" style="width:100px">
User:<input type="text" name="ifxuser" value="{$ifxuser}" style="width:100px">
Pass:<input type="text" name="ifxpass" value="{$ifxpass}" style="width:100px"><br><br>
<script language="javascript">
function ifxFull(i){
\tStr = new Array(11);
Str[0] = "";
\tStr[1] = "select dbservername from sysobjects;";
Str[2] = "select name from sysdatabases;";
Str[3] = "select tabname from systables;";
Str[4] = "select colname from syscolumns where tabid=n;";
Str[5] = "select username,usertype,password from sysusers;";
\tifxform.ifxsql.value = Str[i];
\treturn true;
}
</script>
<textarea name="ifxsql" style="width:600px;height:200px;">{$ifxquery}</textarea><br>
<select onchange="return ifxFull(options[selectedIndex].value)">
\t<option value="0" selected>command</option>
<option value="1">dbservername</option>
<option value="1">databases</option>
<option value="2">tables</option>
<option value="3">columns</option>
<option value="4">hashes</option>
</select>
<input type="hidden" name="action" value="ifxquery">
<input class="bt" type="submit" value="Query"></div></form>
END;
if ($ifxaction == 'ifxquery') {
$ifxlink = ifx_connect($ifcdbname, $ifxuser, $ifxpass) or die(ifx_errormsg());
$ifxresult = ifx_query($ifxquery, $ifxlink) or die(ifx_errormsg());
$ifxrow = ifx_fetch_row($ifxresult);
echo '<font face="verdana">';
echo '<table border="1" cellpadding="1" cellspacing="2">';
echo "\n<tr>\n";
for ($i = 0; $i < ifx_num_fields($ifxresult); $i++) {
echo '<td bgcolor="#228B22"><b>' . ifx_fieldproperties($ifxresult);
echo "</b></td>\n";
}
echo "</tr>\n";
mysql_data_seek($ifxresult, 0);
while ($ifxrow = ifx_fetch_row($ifxresult)) {
echo "<tr>\n";
for ($i = 0; $i < ifx_num_fields($ifxresult); $i++) {
echo '<td bgcolor="#B8B8E8">';
echo "{$ifxrow[$i]}";
echo '</td>';
}
echo "</tr>\n";
}
echo "</table>\n";
echo "</font>";
ifx_free_result($ifxresult);
ifx_close();
}
} elseif ($db == "db2") {
$db2host = isset($_POST['db2host']) ? $_POST['db2host'] : 'localhost';
$db2port = isset($_POST['db2port']) ? $_POST['db2port'] : '50000';
$db2user = isset($_POST['db2user']) ? $_POST['db2user'] : 'root';
$db2pass = isset($_POST['db2pass']) ? $_POST['db2pass'] : '123456';
$db2dbname = isset($_POST['db2dbname']) ? $_POST['db2dbname'] : 'mysql';
$db2action = isset($_POST['action']) ? $_POST['action'] : '';
示例8: _connect
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
{
if (!function_exists('ifx_connect')) {
return null;
}
// PARCHE******
putenv("DBDATE=DMY4/");
putenv("INFORMIXDIR=/opt/informix");
putenv("PATH=/opt/informix:/opt/informix/bin:/opt/informix/msg");
putenv("LD_LIBRARY_PATH={$INFORMIXDIR}/lib:{$INFORMIXDIR}/lib/esql");
putenv("OPTOFC=1");
//********
$dbs = $argDatabasename . "@" . $argHostname;
if ($argHostname) {
putenv("INFORMIXSERVER={$argHostname}");
}
putenv("INFORMIXSERVER=" . trim($argHostname));
$this->_connectionID = ifx_connect($dbs, $argUsername, $argPassword);
if ($this->_connectionID === false) {
return false;
}
#if ($argDatabasename) return $this->SelectDB($argDatabasename);
return true;
}