[Phpmyadmin-devel] [Create PHP Code] creates unexpected results	when defining a trigger in SQL window ?
    Bill Hernandez 
    ms at mac-specialist.com
       
    Fri Jul 31 03:05:58 CEST 2009
    
    
  
> Everything went well, phpMyDamin was happy, but when I clicked on
> [Create PHP Code] the result below was not what I had expected :
>
> ------------------------------------------------------
> $sql = "# MySQL returned an empty result set (i.e. zero rows).\n"
>     . "\n"
>     . "DELIMITER ;\n"
>     . "";
> ------------------------------------------------------
>
> Any Ideas what I might be doing wrong ?
The interesting thing is that if you look at the structure for the  
table prior to entering any records, and :
( 1 ) I click on the "Details..." link at the bottom of the page
( 2 ) I can see the "telephones_insert_trigger" I had just entered via  
the SQL window.
( 3 ) I click on the pencil icon, and there's my TRIGGER in a SQL  
Query window...
( 4 ) I look it over, and am happy to see how easy this will be to  
modify, but I just click on the [GO] button
( 5 ) Now I see the phMyAdmin green happy message : Your SQL query has  
been executed successfully
( 6 ) Below that I see :
-----------------------------------------------
DROP TRIGGER IF EXISTS `mvc_project_01`.`telephones_insert_trigger`//#  
MySQL returned an empty result set (i.e. zero rows). CREATE TRIGGER  
`mvc_project_01`.`telephones_insert_trigger` BEFORE INSERT ON  
`mvc_project_01`.`telephones` FOR EACH ROW BEGIN SET NEW.created =  
NOW(); SET NEW.modified = NOW(); END //# MySQL returned an empty  
result set (i.e. zero rows).
-----------------------------------------------
( 7 ) Now I click on [Create PHP Code] again, but this time I get the  
expected results, shown below :
Showing as PHP code
-----------------------------------------------
$sql = "DROP TRIGGER IF EXISTS  
`mvc_project_01`.`telephones_insert_trigger`//# MySQL returned an  
empty result set (i.e. zero rows).\n"
     . "\n"
     . "CREATE TRIGGER `mvc_project_01`.`telephones_insert_trigger`  
BEFORE INSERT ON `mvc_project_01`.`telephones`\n"
     . " FOR EACH ROW BEGIN\n"
     . " SET NEW.created = NOW();\n"
     . " SET NEW.modified = NOW();\n"
     . " END\n"
     . "//# MySQL returned an empty result set (i.e. zero rows).\n"
     . "";
-----------------------------------------------
So it appears as though when you first create the trigger and click on  
[Create PHP Code] you only get :
-----------------------------------------------
     $sql = "# MySQL returned an empty result set (i.e. zero rows).\n"
     . "\n"
     . "DELIMITER ;\n"
     . "";
-----------------------------------------------
But once you edit the trigger, save it, and click on [Create PHP Code]  
a second time you get the expected answer...
Thank You...
Bill Hernandez
Plano, Texas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20090730/8c233b00/attachment.html>
    
    
More information about the Developers
mailing list