I write a test page to insert PM manually. But every time
when it executes privmessage.insert(&$pm)
!$result = $this->db->query($sql)
The $result is always empty and no row updated. following is test.php and debug code in privmessage.php
-----------------------------------------
require('header.php');
// Include the page header
include(XOOPS_ROOT_PATH.'/header.php');
$pm_handler =& xoops_gethandler('privmessage');
$pm =& $pm_handler->create();
$pm->setVar("subject", "New App");
$pm->setVar("msg_text", "New Text");
$pm->setVar("to_userid", "1");
$pm->setVar("from_userid", "1");
if (!$pm_handler->insert($pm)) {
echo $pm->getHtmlErrors();
echo "failed";
} else {
echo "done";
}
?>
-----------------------------------
// $Id: privmessage.php,v 1.3 2003/03/27 14:52:15
function insert(&$pm)
{
......//code neglected
if (!$result = $this->db->query($sql)) {
echo "Bad SQL:
$sql
";
echo "Result:$result!";
return false;
}
echo "Good SQL:\n$sql";
if (empty($msg_id)) {
$msg_id = $this->db->getInsertId();
}
$pm->assignVar('msg_id', $msg_id);
return true;
}
?>
----------------------------------------
//the printouts when using test.php
Bad SQL:
INSERT INTO xoops_priv_msgs (msg_id, msg_image, subject, from_userid, to_userid, msg_time, msg_text, read_msg) VALUES (0, 'icon1.gif', 'New App', 1, 1, 1119064960, 'New Text', 0)
Result:!
//the printouts when using PM module
Good SQL:
INSERT INTO xoops_priv_msgs (msg_id, msg_image, subject, from_userid, to_userid, msg_time, msg_text, read_msg) VALUES (0, 'icon1.gif', 'test1', 1, 1, 1119063876, 'test text', 0)
---------------------------------------
Why is this happening?? Can anybody help? How can I get a READABLE DB error msg? Many thanks!