Hiya Bob,
Ya, I understand that. What i meant, and should have said rather is that i cannot get it to actually write to the fireboard tables. It's just not getting there. I can execute the sql queries from the code on my database and it writes the info to the fb tables. I'm thinking it may be not connecting to the database?
Here is the code that I have now..
- Code: Select all
<?php
$db_host = "knightsoftheroseguild.com";
$db_user = "xxxxxx";
$db_pwd = "xxxxxx";
$db_name = "joomla";
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
$author = "Appbot";
$subject = $_POST['char_name']." - ".$_POST['class'];
$date = strtotime("now");
$_POST['armory']="[URL=".$_POST['armory']."]LINK[/URL]";
foreach($_POST as $key => $value) {
// capitalize the first letter of each field
$key = ucfirst($key);
//make the title bold
$key = "[b]".$key."[/b]";
//make it part of the msg string
$msg = $msg." ".$key." : ".$value."
“;
}
// get rid of the submit button bit at the end
$msg_array = explode("[b]Button", $msg);
$msg = $msg_array[0];
/* $msg = substr($msg, 0, -3); */
// Because I'm lazy ...
$msg=str_replace("
“,”\n\n”,$msg);
// Create the new topic
$create_thread = "INSERT INTO `joomla`.`jos_fb_messages` SET id=NULL, parent=0, thread=0, catid=43, name='$author', userid=328, email=NULL, subject='$subject', time=$date, ip=NULL";
mysql_query($create_thread) or die(mysql_error());
// Figure out what the correct threadid is of that new topic
$mesid=mysql_insert_id();
// Set the thread id to the same as the message id, as it's the first in the thread
// Note: this solves the order problem in the forum
$set_thread="update jos_fb_messages set thread=id where id=$mesid";
mysql_query($set_thread) or die(mysql_error());
// Tell the forum that there's a new latest message
// Note: this solves the problem where the new message isn't showing up as the latest message in the forum
// Note: it's the categories table because FB sees categories and forums as the same thing
$set_forum="update jos_fb_categories set id_last_msg=$mesid where id=43";
mysql_query($set_forum) or die(mysql_error());
// Stick the $msg variable into the body of the topic
$insert_msg="INSERT INTO `joomla`.`jos_fb_messages_text` SET mesid=$mesid, message='$msg'";
mysql_query($insert_msg) or die(mysql_error());
?>
I did a little investigation and changed the catid, userid and such... like I said, works as individual sql queries, just not all together.. not sure if it's not connecting to the database, if chronoforms just dont like doing it this way, or maybe it's just put together incorrectly.