I've the next table..

CREATE TABLE `community_data_1` (
    `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    `type` VARCHAR(1) NOT NULL,
    `reply_to_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
    `subject` TEXT NOT NULL,
    `post` MEDIUMTEXT NOT NULL,
    `html` VARCHAR(1) NOT NULL DEFAULT '0',
    `time_stamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `author_id` BIGINT(20) UNSIGNED NOT NULL,
    `d_id` BIGINT(20) UNSIGNED NOT NULL,
    PRIMARY KEY (`id`)
)
ENGINE=MyISAM
ROW_FORMAT=DEFAULT

now whenever an place is performed... Following the place i have to see if the d_id value is placed to zero, if it's then i have to update it towards the same return as those of the id of this row. How do you do that? Help.. I'm beginner in triggers.

delimiter |

CREATE TRIGGER fixValue BEFORE INSERT ON community_data_1
  FOR EACH ROW BEGIN

    IF NEW.d_id = 0 THEN
        SET @NewId= (SELECT MAX(id)+1 FROM community_data_1);
        SET NEW.d_id = NewId;
    END IF;
  END;
|

delimiter ;