Err well, the problem is mine since I'm new to SQL.

    I have an mysql server running and have a data source that contains text
posts. I'd like to setup a script that will search for "string1" and replace
it with "string2".

    There may be text before or after this statement that must remain
un-altered.

    An Actual data sample:

        The data looks like this:

            [quote author=TRiN -=[ASWP]=-
link=board=general;num=1024881319;start=0#0 date=06/23/02 at 20:15:19]Now
this one I've never seen before.[/quote]

        But needs to look like this:

            [quote]Now this one I've never seen before.[/quote]

    I also need to do the following:

        '{some text}<br>{some text}'

    Needs to be stripped of <br>

    Resulting in:

         '{some text}[return character of another type]{some text}'

    I'd like to be able to do this in a mass conversion across 30000
records.....

    I found a PHP script that might do the job (posted below), this was
designed to make a mass html change to tags in a database. I however seems
to need wildcards to carry this out...

    I'm wondering if there is a simple mysql command that will accomplish
this task, if this script is suitable, or if I just don't have any chance
with this current info I have.

    The script I found follows... any comments or help appreciated! I'm
doing my best as a newbie.....


<?php
$sql_links = "select * from table where content = '<div align=center><TABLE
width=70% border=0><TR><TD>' ";
  $result = mysql_query ($sql_links);

$num_check =  mysql_num_rows($result);
  echo"<br>found: $num_check<br>";

  while ($row = mysql_fetch_array($result))
              {
              $change=$row["content"];

              }

              if($change == '<div align=center><TABLE width=70%
border=0><TR><TD>'){
              $change2 = "<div align=center><TABLE width=100%
border=0><TR><TD>";
  $sql_update = "update table set content='$change2' where
content='$change'";
         $result = mysql_query ($sql_update);
         }



?>




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to