Page 1 of 1

Insert variable into database

Posted: Sat Jan 22, 2011 2:30 am
by Rahul Dev
Hello guys, i have a problem when inserting a variable into mysql db the code is as follows

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;
			}
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?

Re: Insert variable into database

Posted: Sat Jan 22, 2011 4:35 am
by social_experiment
What does the SummarizeArticle() function do, can you paste the code for it?

Code: Select all

$summary = SummarizeArticle($item_id);