如何在HTML页面中显示Firebird表结构?
我尝试使用下面的代码在HTML页面中显示表结构:
<HTML>
<HEAD>
<TITLE>PHP + Firebird / Interbase test (connection)</TITLE>
</HEAD>
<BODY>
<H3>FB Connect test.</H3>
<?php
// DB definition of account
define("DBNAME","xx.xxx.xx.xxx:D:\DATABASE\OCS DATA.FDB"); // data bsse name
define("DBUSER","USER"); // user name
define("DBPASS","USER"); // password
// DB connection
$dbh = ibase_connect(DBNAME,DBUSER,DBPASS);
echo ibase_errmsg();
if ($dbh == FALSE) {
echo 'could not connect to DB<BR>';
} else {
echo 'success to connect to DB<BR>';
}
$ibsql = "SHOW TABLE DOC_TO";
echo ibase_errmsg();
$result=ibase_query($ibsql);
echo $result;
?>
</BODY>
</HTML>
为什么它只显示结果为“成功连接到数据库”?
I try to use the code below to show table structure in a HTML page:
<HTML>
<HEAD>
<TITLE>PHP + Firebird / Interbase test (connection)</TITLE>
</HEAD>
<BODY>
<H3>FB Connect test.</H3>
<?php
// DB definition of account
define("DBNAME","xx.xxx.xx.xxx:D:\DATABASE\OCS DATA.FDB"); // data bsse name
define("DBUSER","USER"); // user name
define("DBPASS","USER"); // password
// DB connection
$dbh = ibase_connect(DBNAME,DBUSER,DBPASS);
echo ibase_errmsg();
if ($dbh == FALSE) {
echo 'could not connect to DB<BR>';
} else {
echo 'success to connect to DB<BR>';
}
$ibsql = "SHOW TABLE DOC_TO";
echo ibase_errmsg();
$result=ibase_query($ibsql);
echo $result;
?>
</BODY>
</HTML>
Why does it just show the result as "success to connect to DB"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Firebird 似乎没有特定于 MySQL。
文档 指出
SHOW TABLES
命令仅在isql 命令行工具中可用,而无处可用别的。它继续提供以下 SQL 代码作为大致等效的解决方案:
也许您可以通过查询 RDB$RELATIONS 表(或者可能是 Firebird 提供的其他一些运行时信息表)来获得与您试图完成的内容相同的内容。另请参阅 Lorenzo Alberton 关于从 Firebird 数据库中提取 META 信息的帖子。
Firebird does not seem to have a
SHOW TABLE
orSHOW TABLES
command which are specific to MySQL.The documentation on the IBphoenix web site states that the
SHOW TABLES
command is only available in the isql command line tool and nowhere else.It goes on and provides the following SQL code as a roughly equivalent solution:
Maybe you can get something equivalent from what you were trying to accomplish by querying the
RDB$RELATIONS
table (or maybe some other runtime information tables provided by Firebird). See also Lorenzo Alberton's post on extracting META information from a Firebird database.请注意,在 PHP 中您应该使用单引号
$reqest = 'select ...';
否则$
符号将被翻译为 PHP 变量符号。Note than in PHP you should use single quotes
$reqest = 'select ...';
otherwise the$
symbol will be translated as PHP variable sign.