Laserlight you are right. At the time I posted I was behind a firewall with no direct access to the web hence the easy syntax error when I retyped it.
Here is the current version of the code with the or die stuff added too:
$sql=mysql_query("select * from table3")
OR die(mysql_error());
$string='Very best always';
print "<table border=\"1\"><tr><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th></tr>";
while ($row = mysql_fetch_assoc($sql))
{
$pos=strpos($row[text_field], $string);
$out=strtr((trim(substr($row[text_field],0, $pos))),'\'','~') ;
$ID=$row[primary_key_field];
if ($pos!=0)
{
mysql_query("UPDATE table3 SET text_field=(' . $out .')
WHERE primary_key_field=(' . $id . ')")
OR die(mysql_error());
}
print "<tr><td>$ID</td><td> $row[YM_ID]</td><td>$out</td><td>$pos</td><td>$row[text_field]</td></tr>";
unset($out, $pos, $ID);
}
print "</table>";
Thanks for looking at it. It still goes through without error, but not updating. The $string value changes as I test so I can get different length of characters in the selection set.
For kicks and grins I cut and pasted this part of yours -
mysql_query("UPDATE table1 SET text_field='" . $out . "'"
VS - my ('.$out.')
Same results.
The $out line really has a \backslash which gets dropped when cut and pasted into the forum.
jkurrle
Thanks for looking too. My challenge does not seem to be with the data set itself, but rather the updating. I have tried several different ways while doing this with the same result. Though I will admit I did not think of using explode in this. The $out has exactly the selection set I want updated, and if I substitute a smaller data set, it updates fine. I think I will rewrite it using insert and use a replacement table and see how that goes. I avoided that initially because of the amount of data, seemed inefficient to recreate a 400K row table unnecessarily, especially given the large text fields.