General Community > Scripting Help
SMF1 Trying to get Auto_increment value.
MrMorph:
Guys, thanks. I have to go eat now, I will try and digest all you are saying when I come back :)
MrMorph:
--- Quote from: MrPhil on May 20, 2012, 12:46:44 PM ---In one place you say that your $db_prefix is 'smf1', and in another you say your actual table name is 'merc_message_log', which means $db_prefix is probably 'merc_'. 'message_log' is not a standard SMF table, but I'm assuming that you've got it named in the same manner as the standard tables. Is 'smf1' actually the database name? It might have your account name prefixed to it for the Settings.php entry $db_name.
--- End quote ---
Nope, I never said that, and there seems to be some confusion here. This is what I said and it answers your other question too:
--- Quote ---My database does not have a prefix. My database is named smf1
--- End quote ---
When asked what my real table was called, I replied :
--- Quote ---merc_message_log
--- End quote ---
merc_ is not a prefix...
Maybe it was this part that threw you :
--- Quote ---When I echo out $db_prefix on my page that uses SSI.php I get this (quotes included) :
--- Code: ---`smf1`.
--- End code ---
--- End quote ---
--- Quote ---For updating the auto_increment field, just insert with a null for that field, or omit that field entirely (if you list the fields you do give by name). I agree that you run a great risk of having a duplicate ID by trying to specify it explicitly, which will lead to a duplicate key error. All you're trying to do is insert a new record with a unique ID?
--- End quote ---
It works the way I am doing it, so I will probably stick with that for now. I'm not trying to insert anything, I simply need the Auto_increment value at that time of a particular table. It is not important if something else happens in the meantime to that table.
Arantor:
--- Quote ---It is not important if something else happens in the meantime to that table.
--- End quote ---
Except, say, another process inserting a new row, making the auto-increment wrong.
MrMorph:
Yep I know what you are saying, but it's not important if that happens.
Arantor:
So if the value isn't important, why bother going to the trouble of getting the auto-inc value in the first place?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version