| 241 | | $result = db_query("INSERT INTO {acidfree_cmml_clips} (`nid`, `a_href`, `a_text`, `img`, `desc`, `start`, `end`, `id`, `track`) VALUES('{$node->nid}', '{$attributes['a_href']}', '{$attributes['a_text']}', '{$attributes['img']}', '{$attributes['desc']}', '$start', '{$attributes['end']}','{$attributes['id']}', '{$attributes['track']}');"); |
|---|
| | 243 | |
|---|
| | 244 | /* Check whether we need to create a new clip or just update an |
|---|
| | 245 | * old one. |
|---|
| | 246 | */ |
|---|
| | 247 | $occurances = db_result(db_query("SELECT COUNT(`id`) FROM {acidfree_cmml_clips} WHERE `id` = '{$attributes['id']}';")); |
|---|
| | 248 | |
|---|
| | 249 | if( $occurances == 0 ) { |
|---|
| | 250 | $result = db_query("INSERT INTO {acidfree_cmml_clips} (`nid`, `a_href`, `a_text`, `img`, `desc`, `start`, `end`, `id`, `track`) VALUES('{$node->nid}', '{$attributes['a_href']}', '{$attributes['a_text']}', '{$attributes['img']}', '{$attributes['desc']}', '$start', '{$attributes['end']}','{$attributes['id']}', '{$attributes['track']}');"); |
|---|
| | 251 | } else { |
|---|
| | 252 | $result = db_query("UPDATE {acidfree_cmml_clips} SET `nid` = '{$node->nid}', `a_href` = '{$attributes['a_href']}', `a_text` = '{$attributes['a_text']}', `img` = '{$attributes['img']}', `desc` = '{$attributes['desc']}', `start` = '$start', `end` = '{$attributes['end']}', `id` = '{$attributes['id']}', `track` = '{$attributes['track']}' WHERE `id` = '{$attributes['id']}';"); |
|---|
| | 253 | } |
|---|