PHP Code:
require_once('./includes/adminfunctions_language');
$phrasetypeid = add_phrase_type('myphrases', 'These are my phrases');
if (!$phrasetypeid) {
// Hmm ... smth. went wrong. Let's see if it already exists
$check = $DB_site->query_first("SELECT phrasetypeid FROM " . TABLE_PREFIX . "phrasetype WHERE fieldname = 'myphrases'");
if ($check['phrasetypeid']) {
// Oh, my phrasegroup does already exist!
// Guess this is an update then
// My phrasetypeid is $check['phrasetypeid'] and I can use it now the insert phrases
} else {
// W00t !?! My phrasegrouop can't be created AND does not exist yet?
// Fatal Error, call 911 and wreak havoc!
}
} else {
// Fine! My phrasegroup has been created, its ID is $phrasetypeid and I can use it now to insert phrases
}