1
wtravel
Problems with Update query regarding text

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

Login

Who's Online

403 user(s) are online (324 user(s) are browsing Support Forums)


Members: 0


Guests: 403


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits