Index: wp-db.php
===================================================================
--- wp-db.php	(revision 2613)
+++ wp-db.php	(working copy)
@@ -76,8 +76,12 @@
 	// ====================================================================
 	//	Format a string correctly for safe insert under all PHP conditions
 	
-	function escape($str) {
-		return addslashes($str);				
+	function escape ($string) {
+		if(!$this->dbh || version_compare(phpversion(),'4.3.0')=='-1') {
+			return mysql_escape_string($string);
+		} else {
+			return mysql_real_escape_string($string, $this->dbh);
+		}
 	}
 
 	// ==================================================================
