本文整理汇总了PHP中wpdb::show_errors方法的典型用法代码示例。如果您正苦于以下问题:PHP wpdb::show_errors方法的具体用法?PHP wpdb::show_errors怎么用?PHP wpdb::show_errors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpdb
的用法示例。
在下文中一共展示了wpdb::show_errors方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unserialize
function __toString()
{
// if the playlist are saved to db, i load it from db
$playlist = $this->wpdb->get_row("SELECT ID, url, playlist FROM " . $this->table_name . " WHERE url = '" . $this->url . "'");
if ($this->wpdb->num_rows > 0) {
$playlist = unserialize($playlist->playlist);
} else {
$playlist = array();
$code = implode("", file($this->url));
if ($code == "") {
$this->errors->add('no_content', __('The url $url are not valid!'));
}
preg_match_all("/section-row-track(.+)/", $code, $results);
for ($i = 0; $i < sizeof($results[0]); $i++) {
preg_match("/class=\"tracklisttrackname mx-link\">(.+)<\\/a>/U", $results[0][$i], $match);
$title = $match[1];
preg_match("/class=\"tracklistartistname mx-link\">(.+)<\\/a>/U", $results[0][$i], $match);
$artist = $match[1];
if ($title != "" || $artist != "") {
$playlist[] = array("title" => $title, "artist" => $artist);
}
}
$this->wpdb->show_errors();
// save to db the playlist for this url
$this->wpdb->insert($this->table_name, array("url" => $this->url, "playlist" => serialize($playlist)), array("%s", "%s"));
}
$code = "<h3>Playlist</h3><ul class='mixcloud-embed-playlist'>";
for ($i = 0; $i < count($playlist); $i++) {
$code .= "<li><span class='mixcloud-embed-position'>" . ($i + 1) . "</span>";
$code .= "<span class='mixcloud-embed-artist'>" . $playlist[$i]["artist"] . "</span>";
$code .= "<span class='mixcloud-embed-title'>" . $playlist[$i]["title"] . "</span></li>";
}
$code .= "</ul>";
return $code;
}
示例2: fleet_roster_handler
function fleet_roster_handler($atts)
{
extract(shortcode_atts(array('prefix' => ''), $atts));
$response = '';
if ($prefix) {
$novadb = new wpdb('<username>', '<user password>', '<database>', '<server>');
if ($novadb->show_errors()) {
return $novadb->show_errors();
}
$response = '';
$query = "SELECT pos_name, pos_open from " . $prefix . "_positions_sto where pos_open > 0 order by pos_dept, pos_order;";
$rows = $novadb->get_results($query);
if (!$novadb->num_rows) {
return "No Positions available at this time.";
}
$i = 0;
foreach ($rows as $row) {
$response .= $row->pos_name;
if ($row->pos_open > 1) {
$response .= ' (' . $row->pos_open . ' open)';
}
$i++;
if ($i < $novadb->num_rows) {
$response .= ' - ';
}
}
return $response;
}
return 'Please enter a Command Prefix Code.';
}
示例3: upgrade
/**
* Upgrade routine
* - Creates log table on plugin activation
* - Migrates table structure on updates
*/
public function upgrade()
{
$log_db_version = get_option(self::OPTION_DB_VERSION, 0);
// only run upgrade routine when database version is lower than code version
if (version_compare(self::DB_VERSION, $log_db_version, '<=')) {
return;
}
global $charset_collate;
// don't show errors as this would mess with plugin activation
$this->db->hide_errors();
// Create table if it does not exist
$sql = "\n\t\tCREATE TABLE IF NOT EXISTS {$this->table_name} (\n ID BIGINT(20) NOT NULL AUTO_INCREMENT,\n email VARCHAR(255) NOT NULL,\n list_ids VARCHAR(255) NOT NULL,\n method VARCHAR(255) NOT NULL,\n type VARCHAR(255) NOT NULL,\n success TINYINT(1) DEFAULT 1,\n\t\tdata TEXT NULL,\n related_object_ID BIGINT(20) NULL,\n url VARCHAR(255) DEFAULT '',\n datetime timestamp DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (ID)\n\t\t) {$charset_collate}";
$this->db->query($sql);
// update to v1.0.4
if (version_compare($log_db_version, '1.0.4', '<=')) {
// change 'sign-up_form' in 'sign-up-form';
$this->db->query("UPDATE `{$this->table_name}` SET `signup_type` = 'sign-up-form' WHERE `signup_type` = 'sign-up_form'");
}
// update to v1.1
if (version_compare($log_db_version, '1.1', '<=')) {
// merge columns `form_ID` and `comment_ID` into `related_object_ID`
$this->db->query("ALTER TABLE `{$this->table_name}` CHANGE COLUMN `form_ID` `related_object_ID` BIGINT(20)");
$this->db->query("UPDATE `{$this->table_name}` SET `related_object_ID` = `comment_ID` WHERE `related_object_ID` = 0 AND `comment_ID` > 0 ");
$this->db->query("ALTER TABLE `{$this->table_name}` DROP COLUMN `comment_ID`");
// add 'success' column
$this->db->query("ALTER TABLE `{$this->table_name}` ADD COLUMN `success` TINYINT(1) DEFAULT 1");
// rename columns
$this->db->query("ALTER TABLE `{$this->table_name}` CHANGE COLUMN `signup_method` `method` VARCHAR(255)");
$this->db->query("ALTER TABLE `{$this->table_name}` CHANGE COLUMN `signup_type` `type` VARCHAR(255)");
$this->db->query("ALTER TABLE `{$this->table_name}` CHANGE COLUMN `merge_vars` `data` TEXT");
// alter datatype of `datetime`
$this->db->query("ALTER TABLE `{$this->table_name}` CHANGE COLUMN `datetime` `datetime` timestamp DEFAULT CURRENT_TIMESTAMP");
// change `sign-up-form` to just `form`
$this->db->query("UPDATE `{$this->table_name}` SET `type` = 'form' WHERE `type` = 'sign-up-form'");
}
$this->db->show_errors();
update_option(self::OPTION_DB_VERSION, self::DB_VERSION);
}
示例4: register_my_menus
array( 'name' => '1m_comments_magic_number', 'label' => 'Magic number', 'description' => '' ),
array( 'name' => '1m_lucky_id', 'label' => 'Winner ID', 'type' => 'text', 'description' => 'This the ID of the 1000000th comment.' ),
array( 'name' => 'sep_000', 'label' => $onem_lucky_id_txt, 'type' => 'separator' ),
);
$theme_options = new qqp_option_page( '1m comments', 'qqp_options', $option_args );
*/
// Register the wp 3.0 Menus
add_action('init', 'register_my_menus');
function register_my_menus()
{
register_nav_menus(array('primary-menu' => __('Primary Menu'), 'secondary-menu' => __('Secondary Menu')));
}
// Add extra Database Object Instance for XMLTeam Stats
$newdb = new wpdb('np_srolland', 'hio_st@ts', 'np_sportsdb', '10.22.199.137');
$newdb->show_errors();
// Ready for theme localisation
load_theme_textdomain('framework');
// Register the sidebars and widget classes
if (function_exists('register_sidebar')) {
register_sidebar(array('name' => 'Main Sidebar', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
register_sidebar(array('name' => 'Footer 1', 'before_widget' => '<div id="%1$s" class="widget %2$s foot-widget-one">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
register_sidebar(array('name' => 'Footer 2', 'before_widget' => '<div id="%1$s" class="widget %2$s foot-widget-two">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
register_sidebar(array('name' => 'Footer 3', 'before_widget' => '<div id="%1$s" class="widget %2$s foot-widget-three">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
register_sidebar(array('name' => 'Footer 4', 'before_widget' => '<div id="%1$s" class="widget %2$s foot-widget-four">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
register_sidebar(array('name' => 'Narrow Left', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
register_sidebar(array('name' => 'Narrow Right', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
register_sidebar(array('name' => 'Sidebar Page', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
register_sidebar(array('name' => 'Narrow Left Page', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
register_sidebar(array('name' => 'Narrow Right Page', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
register_sidebar(array('name' => 'Main Right Block', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));