Jump to content

ident_current scope_identity and @@identity when do they work


Recommended Posts

I tried to use the each of the three functions mentioned in the subject line in the following query and kept getting error messages. 

 

$query = "INSERT INTO blogs (blog_id, member_id, title, entry, blog_date) VALUES (0, @@IDENTITY('members'), '{$_POST['title']}', '{$_POST['entry']}', NOW())";

                             

 

Here are the error messages I got for each of the 3 respective functions:

 

 

 

Could not add the entry because: FUNCTION a7522929_dbs.IDENT_CURRENT does not exist. The query was INSERT INTO blogs (blog_id, member_id, title, entry, blog_date) VALUES (0, ident_current('members'), 'We have go so this is your house.', 'Mami Ngeh.', NOW()).

 

 

Could not add the entry because: FUNCTION a7522929_dbs.SCOPE_IDENTITY does not exist. The query was INSERT INTO blogs (blog_id, member_id, title, entry, blog_date) VALUES (0, ident_current('members'), 'We have go so this is your house.', 'Mami Ngeh.', NOW()).

 

 

Could not add the entry because: 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 '('members'), 'We have go so this is your house.', 'Mami Ngeh.', NOW())' at line 1. The query was INSERT INTO blogs (blog_id, member_id, title, entry, blog_date) VALUES (0, @@IDENTITY('members'), 'We have go so this is your house.', 'Mami Ngeh.', NOW()).

 

 

What could possible be going wrong? Seems to me like the functions are deprecated.  Any help is appreciated.

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.