Welcome to Geeklog, Anonymous Thursday, December 26 2024 @ 01:49 pm EST

Geeklog Forums

Database issues..Man do I have issues


moshiach

Anonymous
Ok, I'm sure I'm just missing something. Here's the setup, a table with an auto-increment ID value. Admin adds a new record to it using a form. The record inserts into the table just fine, but how do I get the Id that the record was inserted as? I tried <..the $record=DB_query() statement is here. Just pretend you see it Wink $id = DB_insertID($_TABLES['mytable']); also $id =DB_insertID($record); I even went back to my days using ICON (What a great little string language, by the by. Just saying is all ) and tried $id=DB_insertID($record=DB_query('some mysql stuff')); and $id=DB_insertID(DB_query(stuff)); I'm pulling my hair out because I had to write a kludge to get around it and its inelegance offends my sight.
 Quote

Anonymous

Anonymous
Try $rec=DB_query("INSERT INTO ........"Wink; $id=DB_InsertId(); You were trying too hard. DBWiz
 Quote

Anonymous

Anonymous
DOH! Thanks for the assist Smile
 Quote

All times are EST. The time is now 01:49 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content