Manual inserts with MySQL to SMF

Started by Denagam, April 09, 2006, 05:10:02 PM

Previous topic - Next topic

Denagam

hi,

At the moment I'm trying to insert data into the forum, not only via the forum itselves... but also via some textfields on my website ( trying to integrate more ).

But whatever I try... the topics I create remain invisible, and not sure why.

Here's my code:

$strTime = mktime();
                        
$query  = "insert into smf_messages (ID_TOPIC, ID_BOARD, posterTime, ID_MEMBER, subject, posterName, posterEmail, posterIP, body)";
$query .= "values ('0','79', '$strTime', '1', '$famous', '$username', '[email protected]', '127.0.0.1', '$body')";
mysql_query($query) or die("Failed Query of " . $query);
$idmsg = mysql_insert_id();

$query1  = "insert into smf_topics (ID_BOARD, ID_FIRST_MSG, ID_LAST_MSG, ID_MEMBER_STARTED, ID_MEMBER_UPDATED)";
$query1 .= "values ('79','$idmsg','$idmsg','1','1')";
mysql_query($query1) or die("Failed Query of " . $query1);
$idtopic = mysql_insert_id();

$result = mysql_query("UPDATE smf_messages SET ID_TOPIC = '$idtopic' WHERE ID_MSG = '$idmsg' ")
or die(mysql_error());

$query2  = "insert into smf_log_topics (ID_TOPIC, ID_MEMBER, logTime)";
$query2 .= "values ('$idtopic','1','$strTime')";
mysql_query($query2) or die("Failed Query of " . $query2);
$idlog = mysql_insert_id();


So first I insert a msg,
Then a topic,
Then I update the msg with the topic id,
And as last I insert the smf_log_topics.

Does anyone know where this goes wrong?
Please help   :'(

Harzem

If no satisfying reply comes,

you may try a different approach. Backup your database. Post a new topic, and again back up your database. Inspect the differences of the backup files :)

Denagam

Quote from: HarzeM on April 09, 2006, 05:14:15 PM
If no satisfying reply comes,

you may try a different approach. Backup your database. Post a new topic, and again back up your database. Inspect the differences of the backup files :)

Thats indeed a good idea, thanks :)

But if anyone knows exactly what happens when you add a new topic, like 4 tables being filled, some being updated etc... that would be extremely usefull.

Advertisement: