SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy IGNORE - fixed - LAST_INSERT_ID() not working?

    Hi all,

    EDIT:
    No problem here - I forgot I needed the semi-colons after each query in the phpMyAdmin query window to stop MySQL bawlking at multiple queries at a time - now "fixed".

    I have a couple of INSERT SQL queries which look like this:

    Code:
    INSERT INTO reviews_table
    (id, live, make, model, reviewer, review) 
    VALUES
    (NULL, 0, 1, 45, 2, 'Test Review')
    
    INSERT INTO ratings_table
    (make, model, rating, review) 
    VALUES
    (1, 45, 8, LAST_INSERT_ID())
    reviews_table.id is a primary key. I get an error specifically referring to LAST_INSERT_ID() as emboldened above. MySQL says:

    Code:
    #1064 - You have an error in your SQL syntax
    I am using MySQL 3.23.37, but the manuals seem to indicate this should work. Am I doing something stupid?

    Cheers,

    G
    Last edited by greg.harvey; Mar 14, 2006 at 07:50. Reason: Discovered the problem!


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
  •