Domanda

I created my table in phpMyAdmin and when I was trying to enter some data to test out my trigger I get this: error #1054 - Unknown column 'durl' in 'field list'. I am using phpMyAdmin to insert the data so I am not sure why i get this error as it is a field that is available.

If I delete the trigger then it loads no problem.

Here is the sql query that is generated when I click the edit button in the error message.

 INSERT INTO `herfeven_herfevents`.`evenement` 
(`id`, `title`, `start`, `end`, `allday`, `url`, `durl`, `shop`, `phonenum`, 
 `street`,`city`, `state`, `zipcode`, `description`) 
 VALUES (NULL, 'Tatuaje', '2014-03-21 11:00:00', '2014-03-21 17:00:00', 
 '', '', 'eventDetails.php?id=', 'Test', '6033435555', '120 Test Rd', 
 'Test', 'NH', '03820', 'Testing this out')

Here is the trigger

  CREATE TRIGGER urlUpdate BEFORE INSERT ON evenement 
    FOR EACH ROW
      SET NEW.url = CONCAT(durl, id)

I am using this database for my jQuery FullCalendar and I want the link to pull up the php page based on the event. So I am trying to merge the durl which I have set at default of eventDetails.php?id= and then when this is CONCAT with id it will make the appropriate link.

Any pointers would be greatly appreciated.

Nessuna soluzione corretta

Altri suggerimenti

You can try with:

CREATE TRIGGER urlUpdate BEFORE INSERT ON evenement 
    FOR EACH ROW
      SET NEW.url = CONCAT(NEW.durl, NEW.id)

Please see fiddle here.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top