Q:

MySQL remove images from tables

I have a MySQL database wich contain pages of my website. All of the entries in the table are in html format. All I want to do is to remove <img ... > (images) from the content.
Examples of code that I want to remove:
<img src="/assets/cache/pic/1052add1887d7066f2ed4546cdd1fff0.pageCache.jpg" alt="" title="" class="left">
<img src="res/images/upload/2011/accident-mortal.jpg" alt="" title="" class="middle">
<img src="res/images/upload/2011/evacuare-strada-orizontului.jpg" alt="" title="" class="middle">

Is there a SQL command to do that?
Thanks

A:

Managed to get it working. I've used this PHP code:
<?php

mysql_connect("localhost", "root", "root") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$result = mysql_query("SELECT * FROM wp_posts WHERE post_status='publish'") or die(mysql_error());  
while ($row = mysql_fetch_array($result)) {

    $content = $row['post_content'];
    $content = preg_replace("/<img[^>]+\>/i", "", $content); 
    $content = addslashes($content);
    $id = $row['ID'];
    mysql_query("UPDATE wp_posts SET post_content='".$content."' WHERE ID='".$id."'") or die(mysql_error());  

}

?>

