English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP odbc_foreignkeys() Function Usage and Example

PHP ODBC Reference Manual

The odbc_foreignkeys() function retrieves the foreign key list

Syntax

resource odbc_foreignkeys ( resource $connection_id, string $pk_qualifier, string $pk_owner, string $pk_table, string $fk_qualifier, string $fk_owner, string $fk_table )

Definition and Usage

Retrieves the list of foreign keys in the specified table, or retrieves the foreign keys in other tables that reference the primary key of the specified table.

Return Value

Returns an ODBC result identifier or FALSE on failure.
The result set has the following columns:

  • PKTABLE_QUALIFIER

  • PKTABLE_OWNER

  • PKTABLE_NAME

  • PKCOLUMN_NAME

  • FKTABLE_QUALIFIER

  • FKTABLE_OWNER

  • FKTABLE_NAME

  • FKCOLUMN_NAME

  • KEY_SEQ

  • UPDATE_RULE

  • DELETE_RULE

  • FK_NAME

  • PK_NAME

Parameter

NumberParameters and Description
1

connection_id

ODBC Connection Identifier

2

fk_qualifier

It contains information about the foreign key qualifier

3

fk_qualifier

It contains information about the owner of the foreign key

4

fk_table

It contains information about the foreign key table

Example

Try the following example

<?php
   $input_ID = odbc_connect("DSN", "user_id", "pass_id");
   $result = odbc_foreignkeys($input_ID, "w"3codebox", "dbo", "Categories", "Northwind", "dbo", "Products");
   
   odbc_result_all($result);
?>

PHP ODBC Reference Manual