本文整理汇总了PHP中DBLayer::end_transaction方法的典型用法代码示例。如果您正苦于以下问题:PHP DBLayer::end_transaction方法的具体用法?PHP DBLayer::end_transaction怎么用?PHP DBLayer::end_transaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBLayer
的用法示例。
在下文中一共展示了DBLayer::end_transaction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
<td align="center">{Y*|Y}</td>
<td align="center">{Z*|Z}</td>
</tr>
</table>') . "'");
while (list($conf_name, $conf_value) = @each($config)) {
$db->query('INSERT INTO ' . $db_prefix . "config (conf_name, conf_value) VALUES('{$conf_name}', {$conf_value})") or error('Unable to insert into table ' . $db_prefix . 'config. Please check your configuration and try again.');
}
// Insert some other default data
$db->query('INSERT INTO ' . $db_prefix . "categories (cat_name, disp_position) VALUES('Test category', 1)") or error('Unable to insert into table ' . $db_prefix . 'categories. Please check your configuration and try again.');
$db->query('INSERT INTO ' . $db_prefix . "forums (forum_name, forum_desc, num_topics, num_posts, last_post, last_post_id, last_poster, disp_position, cat_id) VALUES('Test forum', 'This is just a test forum', 1, 1, " . $now . ", 1, '" . $db->escape($username) . "', 1, 1)") or error('Unable to insert into table ' . $db_prefix . 'forums. Please check your configuration and try again.');
$db->query('INSERT INTO ' . $db_prefix . "topics (poster, subject, posted, last_post, last_post_id, last_poster, forum_id) VALUES('" . $db->escape($username) . "', 'Test post', " . $now . ", " . $now . ", 1, '" . $db->escape($username) . "', 1)") or error('Unable to insert into table ' . $db_prefix . 'topics. Please check your configuration and try again.');
$db->query('INSERT INTO ' . $db_prefix . "posts (poster, poster_id, poster_ip, message, posted, topic_id) VALUES('" . $db->escape($username) . "', 2, '127.0.0.1', 'If you are looking at this (which I guess you are), the install of PunBB appears to have worked! Now log in and head over to the administration control panel to configure your forum.', " . $now . ', 1)') or error('Unable to insert into table ' . $db_prefix . 'posts. Please check your configuration and try again.');
$db->query('INSERT INTO ' . $db_prefix . "ranks (rank, min_posts) VALUES('New member', 0)") or error('Unable to insert into table ' . $db_prefix . 'ranks. Please check your configuration and try again.');
$db->query('INSERT INTO ' . $db_prefix . "ranks (rank, min_posts) VALUES('Member', 10)") or error('Unable to insert into table ' . $db_prefix . 'ranks. Please check your configuration and try again.');
if ($db_type == 'pgsql' || $db_type == 'sqlite') {
$db->end_transaction();
}
$alerts = '';
// Check if the cache directory is writable
if (!@is_writable('./cache/')) {
$alerts .= '<p style="font-size: 1.1em"><span style="color: #C03000"><strong>The cache directory is currently not writable!</strong></span> In order for PunBB to function properly, the directory named <em>cache</em> must be writable by PHP. Use chmod to set the appropriate directory permissions. If in doubt, chmod to 0777.</p>';
}
// Check if default avatar directory is writable
if (!@is_writable('./img/avatars/')) {
$alerts .= '<p style="font-size: 1.1em"><span style="color: #C03000"><strong>The avatar directory is currently not writable!</strong></span> If you want users to be able to upload their own avatar images you must see to it that the directory named <em>img/avatars</em> is writable by PHP. You can later choose to save avatar images in a different directory (see Admin/Options). Use chmod to set the appropriate directory permissions. If in doubt, chmod to 0777.</p>';
}
/// Display config.php and give further instructions
$config = '<?php' . "\n\n" . '$db_type = \'' . $db_type . "';\n" . '$db_host = \'' . $db_host . "';\n" . '$db_name = \'' . $db_name . "';\n" . '$db_username = \'' . $db_username . "';\n" . '$db_password = \'' . $db_password . "';\n" . '$db_prefix = \'' . $db_prefix . "';\n" . '$p_connect = false;' . "\n\n" . '$cookie_name = ' . "'punbb_cookie';\n" . '$cookie_domain = ' . "'';\n" . '$cookie_path = ' . "'/';\n" . '$cookie_secure = 0;' . "\n" . '$cookie_seed = \'' . substr(md5(time()), -8) . "';\n\ndefine('PUN', 1);";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
示例2: error
$forum_db->query_build($query) or error(__FILE__, __LINE__);
$query = array('INSERT' => 'poster, poster_id, poster_ip, message, posted, topic_id', 'INTO' => 'posts', 'VALUES' => '\'' . $forum_db->escape($username) . '\', ' . $new_uid . ', \'127.0.0.1\', \'' . $lang_install['Default post contents'] . '\', ' . $now . ', ' . $forum_db->insert_id() . '');
if ($db_type != 'pgsql') {
$query['INSERT'] .= ', id';
$query['VALUES'] .= ', 1';
}
$forum_db->query_build($query) or error(__FILE__, __LINE__);
// Add new post to search table
require FORUM_ROOT . 'include/search_idx.php';
update_search_index('post', $forum_db->insert_id(), $lang_install['Default post contents'], $lang_install['Default topic subject']);
// Insert the default ranks
$query = array('INSERT' => 'rank, min_posts', 'INTO' => 'ranks', 'VALUES' => '\'' . $lang_install['Default rank 1'] . '\', 0');
$forum_db->query_build($query) or error(__FILE__, __LINE__);
$query = array('INSERT' => 'rank, min_posts', 'INTO' => 'ranks', 'VALUES' => '\'' . $lang_install['Default rank 2'] . '\', 10');
$forum_db->query_build($query) or error(__FILE__, __LINE__);
$forum_db->end_transaction();
$alerts = array();
// Check if the cache directory is writable and clear cache dir
if (is_writable(FORUM_ROOT . 'cache/')) {
$cache_dir = dir(FORUM_ROOT . 'cache/');
if ($cache_dir) {
while (($entry = $cache_dir->read()) !== false) {
if (substr($entry, strlen($entry) - 4) == '.php') {
@unlink(FORUM_ROOT . 'cache/' . $entry);
}
}
$cache_dir->close();
}
} else {
$alerts[] = '<li><span>' . $lang_install['No cache write'] . '</span></li>';
}