prefix."addressbook WHERE id='".$wpdb->escape($_GET['id'])."'";
$row = $wpdb->get_row($sql);
if ($_GET['confirm']=='yes') {
$wpdb->query("DELETE FROM ".$wpdb->prefix."addressbook WHERE id='".$wpdb->escape($_GET['id'])."'");
echo '
prefix."addressbook";
If ($wpdb->get_var("SHOW TABLES LIKE '$table_name'")!=$table_name
|| get_option("addressbook_version")!=$addressbook_version ) {
// Call the install function here rather than through the more usual
// activate_blah.php action hook so the user doesn't have to worry about
// deactivating then reactivating the plugin. Should happen seemlessly.
_addressbook_install();
echo '
The Addressbook plugin (version
'.get_option("addressbook_version").') has been installed or upgraded.
';
} ?>
Select an address from below to see its details displayed here.
';
return $out;
}
function _addressbook_install() {
global $wpdb, $addressbook_version;
$table_name = $wpdb->prefix."addressbook";
$sql = "CREATE TABLE " . $table_name . " (
id mediumint(9) NOT NULL AUTO_INCREMENT,
first_name tinytext NOT NULL,
surname tinytext NOT NULL,
organisation tinytext NOT NULL,
email tinytext NOT NULL,
phone tinytext NOT NULL,
address_line1 tinytext NOT NULL,
address_line2 tinytext NOT NULL,
suburb tinytext NOT NULL,
postcode tinytext NOT NULL,
state tinytext NOT NULL,
country tinytext NOT NULL,
website VARCHAR(55) NOT NULL,
PRIMARY KEY (id)
);";
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
dbDelta($sql);
update_option('addressbook_version', $addressbook_version);
}
function addressbook_getselect($name) {
global $wpdb;
$out = "";
return $out;
}
add_filter('the_content', 'addressbook_list');
function addressbook_list($content) {
global $wpdb;
$sql = "SELECT * FROM ".$wpdb->prefix."addressbook ORDER BY first_name";
$results = $wpdb->get_results($sql);
$out = "";
foreach ($results as $row) {
$out .= "