1
I am experiencing a weird problem saving text to mySQL table:
Quote:
$arttext = CreateArticleSummary($aid);
$artsummary = $myts->makeTareaData4Save($arttext);
$published = time();
$sql = sprintf("UPDATE ".$xoopsDB->prefix("x_article")." SET published = '$published', summary = '$artsummary' WHERE aid = $aid");
$xoopsDB->query($sql) or $eh->show("0013");
The function
CreateArticleSummary($aid) seems to work fine, since when I echo the result it is there. But I cannot save it to the database
When I change the line
$arttext = CreateArticleSummary($aid); into
$arttext = "test test test" all of sudden it works fine.
So maybe the problem is caused by the function CreateArticleSummary:Quote:
function CreateArticleSummary($aid)
{
global $xoopsDB;
$block = array();
$myts =& MyTextSanitizer::getInstance();
$result = $xoopsDB->query("SELECT parid, text FROM ".$xoopsDB->prefix("x_paragraphs")." WHERE aid = ".$aid." ORDER BY parid LIMIT 0, 2");
$num_results = mysql_num_rows($result);
if (!$result) {
return 0;
}
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
$arttext = $row['text'];
}
return $arttext;
}
What did I do wrong?
Martijn