Forums

PHP

This topic is locked

update issue

Posted 10 Jul 2008 21:45:36
1
has voted
10 Jul 2008 21:45:36 bharani kumar posted:
dears

am having more then 20000 records,

in each record i want to add the small word like testing,

Below is the code,

due to some reason some record not updating,
this stop the entire update process



Now i want overide this problem,
i want to update the record, if any intrept also occur,
the proess will never stop,



also thing one thing,

we have to show the record id, which are not updated

[php]

mysql_connect("localhost","root","";
mysql_select_db("ameex01" or die("could not select the database";
$sql = "select * from node_revisions where nid=11973";

$rs = mysql_query($sql);
if(mysql_num_rows($rs)>0)
{
while($obj=mysql_fetch_object($rs))
{
$body_chunksplit = $obj->body;
$nid=$obj->nid;
$body_chunksplit=str_replace("'", "\'", $body_chunksplit);
// $lrn = strlen($body_chunksplit);
//$length=$lrn*2;

if(strlen($body_chunksplit) >= 4500)
{

$body_content=break_up($body_chunksplit,'<--pagebreak-->', 4500);

//$body_content=substr(chunk_split($body_chunksplit, 4500, "<--pagebreak-->", 0, $length);
//echo $body_content;
//drupal_set_message(wordcount($body_content));
//$update_query="UPDATE node_revisions SET body='$body_content' where nid='$nid'";

}
else
{
$body_content=$body_chunksplit;
}
if(isset($body_content))
{
$affect=mysql_query("UPDATE node_revisions SET body='$body_content' where nid='$nid'" or die("could not$nid";
//$affect=mysql_query($update_query)or die("could not at '".$nid."'";
}
else
{

}
}
}
[/php]

Reply to this topic