From 7dfafd9381435df08b1467b18f27fb4b2e7251e0 Mon Sep 17 00:00:00 2001 From: AndreaChirulescu Date: Thu, 8 Apr 2021 23:13:42 +0200 Subject: Beginning of a very rudimentary form for adding/editing concerts --- includes/band.php | 97 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 44 deletions(-) (limited to 'includes/band.php') diff --git a/includes/band.php b/includes/band.php index ce3c689..12e80f4 100644 --- a/includes/band.php +++ b/includes/band.php @@ -1,44 +1,53 @@ -. - */ - -if ( !class_exists('GiglogAdmin_Band') ) { - class GiglogAdmin_Band - { - static function create($name) - { - global $wpdb; - - $wpdb->insert('wpg_bands', array( - 'id' => '', - 'wpgband_name' => $name - )); - - return $wpdb->insert_id; - } - - static function find_or_create($name) - { - global $wpdb; - - $bandsql = 'SELECT id FROM wpg_bands WHERE upper(wpgband_name)="' . $name . '"'; - $results = $wpdb->get_results($bandsql); - - return $results ? $results[0]->id : GiglogAdmin_Band::create($name); - } - } -} +. + */ + +if ( !class_exists('GiglogAdmin_Band') ) { + class GiglogAdmin_Band + { + static function create($name) + { + global $wpdb; + + $wpdb->insert('wpg_bands', array( + 'id' => '', + 'wpgband_name' => $name + )); + + return $wpdb->insert_id; + } + + static function find_or_create($name) + { + global $wpdb; + + $bandsql = 'SELECT id FROM wpg_bands WHERE upper(wpgband_name)="' . $name . '"'; + $results = $wpdb->get_results($bandsql); + + return $results ? $results[0]->id : GiglogAdmin_Band::create($name); + } + static function all_bands() + { + global $wpdb; + + $results = $wpdb->get_results("select id, wpgband_name as vname from wpg_bands order by wpgband_name"); + + return ($results); + } + + } +} -- cgit v1.2.3