summaryrefslogtreecommitdiffstats
path: root/includes/band.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/band.php')
-rw-r--r--includes/band.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/includes/band.php b/includes/band.php
index 9ed7a53..72af425 100644
--- a/includes/band.php
+++ b/includes/band.php
@@ -19,26 +19,27 @@
if ( !class_exists('GiglogAdmin_Band') ) {
class GiglogAdmin_Band
{
- static function create($name)
+ static function create($name, $country)
{
global $wpdb;
-
+ if (empty($country)) $country = 'NO';
$wpdb->insert('wpg_bands', array(
'id' => '',
- 'wpgband_name' => $name
+ 'wpgband_name' => $name,
+ 'wpgband_country' => $country
));
return $wpdb->insert_id;
}
- static function find_or_create($name)
+ static function find_or_create($name, $country)
{
global $wpdb;
-
+ if(empty($country)) $country = 'NO';
$bandsql = 'SELECT id FROM wpg_bands WHERE upper(wpgband_name)="' . $name . '"';
- $results = $wpdb->get_results($bandsql);
+ $results = $wpdb->get_results($bandsql);
- return $results ? $results[0]->id : GiglogAdmin_Band::create($name);
+ return $results ? $results[0]->id : GiglogAdmin_Band::create($name, $country);
}
static function all_bands()
@@ -49,6 +50,15 @@ if ( !class_exists('GiglogAdmin_Band') ) {
return ($results);
}
+
+ static function all_countries()
+ {
+ global $wpdb;
+
+ $results = $wpdb->get_results("select id, wpgcountry_name as cname from wpg_countries order by id");
+
+ return ($results);
+ }
}
}