|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21082 odbc_primarykeys Access
Submitted: 2002-12-18 13:28 UTC Modified: 2002-12-18 13:55 UTC
From: jcdavid at libertysurf dot fr Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 4.2.0 OS: Win XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
22 - 17 = ?
Subscribe to this entry?

 [2002-12-18 13:28 UTC] jcdavid at libertysurf dot fr
I cant get the primarykeys, php always return "Warning: SQL error: , SQL state 00000 in SQLPrimaryKeys"

$dsn = "gerhisto"; 
$usr = "";
$pwd = ""; 
$db = "gerhisto";
$con = odbc_connect ($dsn,$usr,$pwd) or die ("Echec de connexion sur ODBC : $dsn");
$res = odbc_tables ($con) or die ("Pas de tables dans $db de ODBC : $dsn");
while (odbc_fetch_row ($res)) {
	if (odbc_result ($res, 4)=="TABLE") {
		  $qualifiers[$i] = odbc_result ($res, 1);
		  $owners[$i] = odbc_result ($res, 2);
		  $tables[$i] = odbc_result ($res, 3);
		  $types[$i] = odbc_result ($res, 4);
		  $remarks[$i] = odbc_result ($res, 5);
		  echo "$i, Table : $tables[$i], Qualifier : $qualifiers[$i], Owner : $owners[$i], Type : $types[$i], Remarks : $remarks[$i]<br>";
echo "<br>$i tables<br><br>";
for ($j=0;$j<$i;$j++) {
  echo "Clefs Primaires de ".$tables[$j];
  $res = odbc_primarykeys ($con, $qualifiers[$j], $owners[$j], $tables[$j]);
  if ($res)
    odbc_result_all ($res);
  	// ==> Warning: SQL error: , SQL state 00000 in SQLPrimaryKeys 
    echo ("Error : ".odbc_error ($con).": ".odbc_errormsg ($con)."<BR>");
odbc_close ($con);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-18 13:55 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

I believe this was fixed...
 [2004-08-27 16:03 UTC] user at example dot com
still does not work with PHP 5.0.1 and MS Access (both odbc_primarykeys() and odbc_statistics()). Please reopen
 [2011-11-29 09:40 UTC] xxdantess at gmail dot com
I have the same problem

$conexion = odbc_connect($DSN,"","");

$result = odbc_tables($conexion);
while (odbc_fetch_row($result)){
$pk = odbc_primarykeys( $conexion,$qualifiers,$owner,$table);

Warning: odbc_primarykeys() [function.odbc-primarykeys]: SQL error: Failed to fetch error message, SQL state HY000 in SQLPrimaryKey

Please fix the problem
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Jul 05 10:05:45 2022 UTC