Insert variable into database
Posted: Sat Jan 22, 2011 2:30 am
Hello guys, i have a problem when inserting a variable into mysql db the code is as follows
when i echo $summary it is displayed correctly but when i save it to db it only saves the article_id but not $summary
any1 can help please?
Code: Select all
foreach($html->find('td[class=rel_headline_cmt]') as $element)
{
//echo $element;
$sql1 = "UPDATE articles SET original_text = '" . mysql_real_escape_string($element) . "' WHERE article_id = '$item_id'";
$result1 = mysql_query($sql1) or die('Query failed: ' . mysql_error());
$summary = SummarizeArticle($item_id);
$sql2 = "INSERT INTO summarization (article_id, summarized_text) VALUES ('$item_id', '" . mysql_real_escape_string($summary) . "')";
$result2 = mysql_query($sql2) or die('Query failed: ' . mysql_error());
echo $summary;
}
any1 can help please?