[support] update related

bharani kumar bharanikumariyerphp at gmail.com
Fri Jul 4 05:21:29 UTC 2008


Hi dear


am having the more then 1000 records,

I want to insert the <--break-->,in that 1000 record ,

in that there is field called body, which contain article, too big content
in that ,
now i want to insert the <--break-->, after every 1075 character has meet,


also Never broke the  html tag...that is dont put the <--break-->

between <<--break-->table>..


for this i written the code


<?php
mysql_connect("localhost","root","admin");
mysql_select_db("sample") or die("could not select the database");
$sql = "select * from node_revisions";
$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=substr(chunk_split($body_chunksplit, 4500, "<--pagebreak-->"),
0, $length);
//drupal_set_message(wordcount($body_content));
}
else
{
$body_content=$body_chunksplit;
}
mysql_query("UPDATE node_revisions SET body='$body_content' where
nid='$nid'") or die("could not");
}


}

?>

This is will not solved my total problem,

Can any find the bug and solve it...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20080704/c0c8994c/attachment.htm 


More information about the support mailing list