SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast laresistance2's Avatar
    Join Date
    May 2011
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL loop problem

    Hello,
    I must create a MySQL function with twenty which inserts data into a table.
    Here is my code:

    Code:
    DELIMITER |
    CREATE FUNCTION dataInsert(id INT)
    BEGIN
    SET @count = 0;
    WHILE @count < id 
    BEGIN
       INSERT INTO user (id, acti, views) VALUES ((id+1),  'OK', 0);
       SET @count = (@count+1)
    END
    END
    |
    Can you tell me the error in this code?
    Thank you.

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,509
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Why, does it give you an error?


Tags for this Thread

Bookmarks

Posting Permissions

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