Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2008
    Posts
    53

    Unanswered: very easy function in mysql doesn't work

    MySQL 5.0.45

    Code:
    CREATE FUNCTION fun() RETURNS INT
    BEGIN
    RETURN 5;
    END;

    #1064 - Something is wrong in your syntax near '' in line 3

    Why ?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    DELIMITER $$
    
    CREATE FUNCTION fun() RETURNS INT
    BEGIN
    RETURN 5;
    END;
    
    $$
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Dec 2008
    Posts
    53
    Code:
    DELIMITER $$ 
    
    CREATE FUNCTION fun() RETURNS INT 
    BEGIN RETURN 5; 
    END; 
    
    $$

    I have still error:
    http://img526.imageshack.us/my.php?i...2009203229.png
    Imageshack - 08282009203042

  4. #4
    Join Date
    May 2007
    Posts
    80
    Possibly you can't do that through phpadmin,
    try connecting direct or use a script outside phpadmin.

  5. #5
    Join Date
    Dec 2008
    Posts
    53
    PEOPLE !! I know !! You must write in phpmyadmin:

    Code:
    CREATE FUNCTION fun5() RETURNS INT 
    BEGIN 
    RETURN 5; 
    END
    without $$ in code !! And then write below in input Separator $$
    Screen: http://yfrog.com/5r57844448j







    And how can I see the result this function using php. It:
    PHP Code:
    $query mysql_query("select fun()");
    echo 
    $query
    Shows me: Resource id #3 :/
    Last edited by chomik; 08-29-09 at 06:11.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •