3
Thanks!
Now i'm having this weird problem... Inserting the story works fine, and inserting a comment onto it also works fine. however, if i reply to the comment (using the website now, not SQL) the reply doesn't show up in nested mode (it does show up in flat mode, though)
what am i doing wrong on the initial comment, that causes this problem down the line?
thanks again!
here is my PHP page that creates a test entry and comment:
$title = "jeremy is really testing!";
$dbuser="xxx";
$dbpass="xxx";
$dbname="xxx"; //the name of the database
$chandle = mysql_connect("xxx", $dbuser, $dbpass)
or die("Connection Failure to Database");
mysql_select_db($dbname, $chandle) or die ($dbname . " Database not found. " . $dbuser);
$table="xoops_stories"; //The name of the table
$query1= "INSERT INTO " . $table . " (uid, title, created, published, expired, hometext, bodytext, counter, topicid) VALUES (1, '".$title."', ". time() . ", " . time() . ", 0, 'foo! again, this is the content la la la la la', 'again, more content...', 0, 1)";
$result = mysql_db_query($dbname, $query1) or die("Failed Query of " . $query1); //do the query
$storyid = mysql_insert_id($chandle);
$row=mysql_fetch_row($result);
if ($result) {
echo "Inserted '$storyid'
";
}
else
{
echo "Maybe not inserted
";
}
$modId = 3;
$query2 = "INSERT INTO xoops_xoopscomments (com_modid, com_itemid, com_created, com_uid, com_ip, com_title, com_text, com_status) VALUES(".$modId.", " . $storyid . ", " . time() . ", 0, '127.0.0.1', '" . $title ." comment', 'phpbar comment text', 2)" ;
$result = mysql_db_query($dbname, $query2) or die("Failed Query of " . $query2); //do the query
$id = mysql_insert_id($this->chandle);
$query3 = "UPDATE xoops_stories SET comments=1 WHERE storyid = " . $storyid;
$result = mysql_db_query($dbname, $query3) or die("Failed Query of " . $query3); //do the query