PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Rahul Dev
Forum Newbie
Posts: 18 Joined: Thu Dec 09, 2010 4:54 am
Post
by Rahul Dev » 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
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?
social_experiment
DevNet Master
Posts: 2793 Joined: Sun Feb 15, 2009 11:08 am
Location: .za
Post
by social_experiment » Sat Jan 22, 2011 4:35 am
What does the SummarizeArticle() function do, can you paste the code for it?
Code: Select all
$summary = SummarizeArticle($item_id);
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering