Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: MySql Triggers

  1. #1

    Default MySql Triggers


    since wala mn programming nga section diri... diri na lng nako i-post.

    kanang kuan ba. kinsa kabalo sa inyo diri ug mysql triggers?

    for example naa ko "subjects_enrolled" na table tapos some of it's attributes are subn_no(primary key), grade, remarks.

    gusto nako nga automatic na ang remarks. for example ang grade kay 2.0 dapat automatic ang value sa remarks as "passed"... so dili na nako i-code sa php ang value sa remarks based sa grade.

  2. #2
    Edit: aw MSSQL diay ni ayaw nalang ni.


    --------------------------------------
    sample trigger from my ran online private server, if new level 1 character created then the level will be change to 100.

    CREATE TRIGGER [dbo].[NewChar_Level] ON [dbo].[ChaInfo]
    after update
    as
    BEGIN

    Update [ChaInfo] set [ChaInfo].ChaLevel=100
    From Inserted
    Where Inserted.ChaLevel = 1 and [ChaInfo].ChaName=inserted.ChaName
    and [ChaInfo].UserNum =inserted.UserNum

    END

  3. #3
    Because we are poor, shall we be vicious? vern's Avatar
    Join Date
    Feb 2003
    Gender
    Male
    Posts
    5,790
    There IS a programming section. You didn't look.

  4. #4
    aw... sori.. wla ko kabantay nalibat ko. hehe.

  5. #5
    murag gamitan mn ni ug mga "if" conditons akoa
    1-3 = passed
    INC = incomplete
    --- = no grad yet

  6. #6
    *bump* tabang mo please

  7. #7
    create trigger setgrade after insert, update on subjects_enrolled
    for each row
    begin
    if new.grade < 2 then
    new.remarks = 'payter doh!'
    elseif new.grade > 3 then
    new.remarks = 'hangbong ka doh!'
    ...
    end;

  8. #8
    weee... salamat.. try daw nako

  9. #9
    dili lage mugana... pati butngan nako ug delimiter ug end if... dili japon

  10. #10
    ---CREATE TRIGGER SET_REMARKS
    --- BEFORE INSERT ON SUBJECTS_ENROLLED
    --- FOR EACH ROW
    --- BEGIN
    --- IF NEW.GRADE > 2.0 THEN
    --- SET NEW.REMARKS = 'PASSED';
    --- ELSE
    --- SET NEW.REMARKS = 'FAILED';
    --- END IF;
    ---END

    try daw ni bai..

  11.    Advertisement

Page 1 of 3 123 LastLast

Similar Threads

 
  1. MySql Triggers
    By xiao-xiao in forum Software & Games (Old)
    Replies: 2
    Last Post: 06-12-2009, 12:33 PM
  2. Webhosting sites with PHP, MYSQL and etc
    By ravenclair3 in forum Websites & Multimedia
    Replies: 9
    Last Post: 08-13-2006, 10:27 PM
  3. remember Chrono trigger and other snes rpg's
    By Wilson in forum Software & Games (Old)
    Replies: 35
    Last Post: 08-25-2005, 07:33 PM
  4. VB OLEDB ---> APACHE SERVER MYSQL
    By rvyne in forum Websites & Multimedia
    Replies: 12
    Last Post: 07-09-2005, 12:10 PM
  5. Where: Cebu based PHP/MySQL based hosting
    By cmontoya in forum Websites & Multimedia
    Replies: 19
    Last Post: 06-29-2005, 10:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top