|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-10-08 16:58 UTC] phperror at gustl dot at
Hi,
i don't get odbc_primarykeys () working with access-dbs. example:
<?php
$dsn = "accessdsn"; $user = ""; $pass = ""; $db = "accessdb";
# $dsn = "mssqldsn"; $user = ""; $pass = ""; $db = "mssqldb";
# $dsn = "mysqldsn"; $user = ""; $pass = ""; $db = "mysqldb";
$con = odbc_connect ($dsn, $user, $pass) or die ("no connect to $dsn");
$res = odbc_tables ($con, $db, "", "%", "'TABLE'") or die ("no tables in $db of $dsn");
odbc_result_all ($res);
echo "<h2>Tables in db $db of $dsn</h2>";
$res = odbc_tables ($con, $db, "", "%", "'TABLE'") or die ("no tables in $db of $dsn");
while (odbc_fetch_row ($res)) {
$qualifiers [] = odbc_result ($res, 1);
$owners [] = odbc_result ($res, 2);
$tables [] = odbc_result ($res, 3);
}
print_r ($tables);
reset ($tables);
while (list ($i, $table) = each ($tables)) {
echo "<h2>keys of ".$table." (".$qualifiers [$i].", ".$owners [$i].")</h2>";
$res = odbc_primarykeys ($con, $qualifiers [$i], $owners [$i], $table);
if ($res)
odbc_result_all ($res);
else
echo (odbc_error ().": ".odbc_errormsg ()."<BR>");
}
##
## must close, otherwise php 4.05RC1, 4.06 crashes
##
odbc_close ($con);
echo ("ende");
?>
in PHP4.06 I get the following php errormsg:
Warning: SQL error: , SQL state 00000 in SQLPrimaryKeys in c:/arbeit/test/odbc2.php4 on line 23
00000:
I tried all the combinations of setting the parameters with spaces and/or "%", no chance.
Gustav Graf
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 14:00:01 2025 UTC |
Hello, I'm having the same problem with win2k, Apache, and PHP 4.2.2, accessing any of a number of Access databases; the error seems to occur with any attempt access any of the following functions: odbc_columns odbc_columnprivileges odbc_tables odbc_tableprivileges incidentally, occasionally the tables functions will actually cause php.exe to crash outright. Here's the simplest example of code that causes the problem: <?php $con = odbc_connect("dev", "", ""); $result = odbc_columnprivileges($con, "", "", "", "%"); ?> cheers, jeff albertI have same problem with odbc_primarykeys when i am using with the DB2. Please guide me my code is <?php //include 'conn.inc'; $usernm="db2admin"; $pwd="nic20pao03lx#"; $schemaname="db2admin."; $conn=odbc_connect("PAOLX",$usernm,$pwd); $m=odbc_primarykeys($conn,"SYSIBM","SYSIBM","TB_DDO_ELECTRICITY"); echo $m; ?>