Jump to content
Larry Ullman's Book Forums

dandandan

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by dandandan

  1. Larry:

     

    Hey I'm really enjoying your book PHP 5 Advanced (c. 2007). However I'm having trouble with the same problems as Mike.

    I currently have a Mac OSX 10.8 and MySQL Workbench running MySQL 5.5.29. Here is the code I am entering:

     

    DELIMITER $$

    CREATE FUNCTION zips.return_distance(lat_a DOUBLE, long_a DOUBLE, lat_b DOUBLE, long_b DOUBLE) RETURNS DOUBLE
    BEGIN
    DECLARE distance DOUBLE;
    SET distance = SIN(RADIANS(lat_a)) * SIN(RADIANS(lat_b ))
    + COS(RADIANS(lat_a))
    * COS(RADIANS(lat_b ))
    * COS(RADIANS(long_a - long_b ));
    RETURN((DEGREES(ACOS(distance))) * 69.09);
    END $$

     

     

    If I try to apply this, I go to a next screen and then when I click apply there again, it will be there was an error while applying this script to the datbase.

     

    For reference, there is a red "x" next to my code by "SET".

     

    Also, I tried entering the code you havea above exactly and that did not work either (sadface) !

     

    Let me know what you think I should do.

×
×
  • Create New...