Forum Moderators: open

Message Too Old, No Replies

Display FOREIGN KEY? with PHP

         

iridion_us

5:32 am on Oct 25, 2007 (gmt 0)

10+ Year Member



I'm trying to display the foreign keys, index etc... etc.. of a table

here are the codes below

<?php
include "opendb.php";

$query = "SHOW CREATE TABLE cclp_teams";
$result = mysql_query($query) or die(mysql_error());

echo "<br>";
echo $result;
echo "<br>";

?>

But my codes has problem.
It says --> Resource id #3

What is wrong with my codes? what function do i need to display the structure of the tables?

thanks in advance.

Habtom

5:44 am on Oct 25, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This should work:

$query = "SHOW CREATE TABLE cclp_teams";
$result = mysql_query($query) or die(mysql_error());
$data = mysql_fetch_array($result);

echo "<br>";
print_r($data);
echo "<br>";

Habtom

[edited by: Habtom at 6:27 am (utc) on Oct. 25, 2007]