当前位置: 首页>>代码示例>>PHP>>正文


PHP WT_DB::query方法代码示例

本文整理汇总了PHP中WT_DB::query方法的典型用法代码示例。如果您正苦于以下问题:PHP WT_DB::query方法的具体用法?PHP WT_DB::query怎么用?PHP WT_DB::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WT_DB的用法示例。


在下文中一共展示了WT_DB::query方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: COUNT

if ($dbname_ok) {
    try {
        // PhpGedView (4.2.3 and earlier) and many other applications have a USERS table.
        // webtrees has a USER table
        $dummy = WT_DB::query("SELECT COUNT(*) FROM `##users`")->fetchOne();
        echo '<p class="bad">', WT_I18N::translate('This database and table-prefix appear to be used by another application.  If you have an existing PhpGedView system, you should create a new webtrees system.  You can import your PhpGedView data and settings later.'), '</p>';
        $dbname_ok = false;
    } catch (PDOException $ex) {
        // Table not found?  Good!
    }
}
if ($dbname_ok) {
    try {
        // PhpGedView (4.2.4 and later) has a site_setting.site_setting_name column.
        // [We changed the column name in webtrees, so we can tell the difference!]
        $dummy = WT_DB::query("SELECT site_setting_value FROM `##site_setting` WHERE site_setting_name='PGV_SCHEMA_VERSION'")->fetchOne();
        echo '<p class="bad">', WT_I18N::translate('This database and table-prefix appear to be used by another application.  If you have an existing PhpGedView system, you should create a new webtrees system.  You can import your PhpGedView data and settings later.'), '</p>';
        $dbname_ok = false;
    } catch (PDOException $ex) {
        // Table/column not found?  Good!
    }
}
if (!$dbname_ok) {
    echo '<h2>', WT_I18N::translate('Database and table names'), '</h2>', '<p>', WT_I18N::translate('A database server can store many separate databases.  You need to select an existing database (created by your server’s administrator) or create a new one (if your database user account has sufficient privileges).'), '</p>', '<fieldset><legend>', WT_I18N::translate('Database name'), '</legend>', '<table border="0"><tr><td>', WT_I18N::translate('Database name'), '</td><td>', '<input type="text" name="dbname" value="', WT_Filter::escapeHtml($_POST['dbname']), '" autofocus></td><td>', WT_I18N::translate('This is case sensitive. If a database with this name does not already exist webtrees will attempt to create one for you. Success will depend on permissions set for your web server, but you will be notified if this fails.'), '</td></tr><tr><td>', WT_I18N::translate('Table prefix'), '</td><td>', '<input type="text" name="tblpfx" value="', WT_Filter::escapeHtml($_POST['tblpfx']), '"></td><td>', WT_I18N::translate('The prefix is optional, but recommended.  By giving the table names a unique prefix you can let several different applications share the same database. “wt_” is suggested, but can be anything you want.'), '</td></tr></table>', '</fieldset>', '<br><hr><input type="submit" id="btncontinue" value="', WT_I18N::translate('continue'), '">', '</form>', '</body></html>';
    exit;
} else {
    // Copy these values through to the next step
    echo '<input type="hidden" name="dbname" value="', WT_Filter::escapeHtml($_POST['dbname']), '">';
    echo '<input type="hidden" name="tblpfx" value="', WT_Filter::escapeHtml($_POST['tblpfx']), '">';
}
////////////////////////////////////////////////////////////////////////////////
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:setup.php


注:本文中的WT_DB::query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。