SMF Support > Converting to SMF

UBB.Classic Converter (Prototype now available)

<< < (2/8) > >>

Mike Bobbitt:
Well, that may have been a bit premature... Everything converted ok, but the board is acting funny. Notably:

1. You can't post a new topic. You get:

--- Code: --- You have an error in your SQL syntax near ')' at line 4
File: /home/bobbitt/www/army/forums/Sources/Post.php
Line: 1121
--- End code ---

2. You can reply to an existing topic, but it won't show up in the forum until you check for (and fix) errors. The reply is there and can be viewed, it just won't "register" in the forum until this is done.

I suspect this is all because I'm converting topic/post IDs from UBB. They don't start at 1, and there are gaps in the numbers. Anyone know why that might be a problem, or if that's even it?


They must start at 1... you *cannot* have a topic or board with an id of 0.


Mike Bobbitt:
Ok, that's good to know... What about starting at a number > 1? Also bad?

Nope, that's fine.  Missing numbers are okay too, as long as they are all above 0.


Mike Bobbitt:
Ok, I have more info on what's happening now... Hopefully someone can shed some light on *why* it's happening.

After a conversion, new posts are inserted into the messages table with an  ID_TOPIC of 0. This causes the next call of db_insert_id to return a value of -1693997287, which is clearly wrong.

This in turn causes the new topic not to have an entry in the topics table since the return value of db_insert_id is negative, that insert is skipped.

I found this about mysql_insert_id:

--- Quote ---mysql_insert_id() converts the return type of the native MySQL C API function mysql_insert_id() to a type of long (named int in PHP). If your AUTO_INCREMENT column has a column type of BIGINT, the value returned by mysql_insert_id()  will be incorrect. Instead, use the internal MySQL SQL function LAST_INSERT_ID() in an SQL query.
--- End quote ---

Since the topic ID fields are medium int, but mysql_insert_id returns int, will that cause a problem?

Or better yet, what have I done wrong! Why is the initial entry in the messages table inserting with a zero ID_TOPIC?

Thanks in advance for any help!


[0] Message Index

[#] Next page

[*] Previous page

Go to full version