problem with stored procedure

Discussion in 'PHP' started by bartolay13, Feb 4, 2008.

  1. #1
    hello,

    this is my error

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER $$

    DROP PROCEDURE IF EXISTS `pdi_db`.`printing` $$
    CREATE DEFINER=' at line 1


    it shows when i upload my database to my server WITH a stored procedure in it.. this is the sample stored procedure

    DELIMITER $$

    DROP PROCEDURE IF EXISTS `pdi_db`.`printing` $$
    CREATE DEFINER=`root`@`localhost` PROCEDURE `printing`()
    BEGIN
    select * from pdi_accounts where id = '3';
    END $$

    DELIMITER ;

    this stored procedure is a template from my GUI tool mysql query browser..
    this is ok in my localhost.. but when i upload it into my server theres this error..

    please help... thanks.
     
    bartolay13, Feb 4, 2008 IP
  2. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    check your mysql versions.

    i had a similar problem at work (today believe it or not) with triggers in mysql, basically the version of mysql we had locally didn't support the trigger syntax we where using on our live site (the local mysql version was 5.0.18 and the live site had 5.0.30), i would highly suggest you make sure the version of mysql you are using locally is the same as the version your host is using.
     
    powerspike, Feb 5, 2008 IP
  3. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #3
    did you fixed this error??

    im thinking this might be the structure of the procedure...

    waiting for reply.
     
    bartolay13, Feb 5, 2008 IP
  4. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, as i said, we upgraded the version of mysql on the localside, the one that was having the errors, and it fixed it outright. As i stated above, make sure the version of mysql your using localy is the same version as your running on your webhost.
     
    powerspike, Feb 5, 2008 IP
  5. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #5
    this is my server mysql client version
    MySQL client version: 4.1.22
    and my mysql client
    MySQL client version: 5.1.11

    does this mean i need to downgrade?
     
    bartolay13, Feb 6, 2008 IP