Insert/Update help needed

From: Date: Thu, 17 Jul 2003 15:32:40 +0000
Subject: Insert/Update help needed
Groups: php.db 
Request: Send a blank email to php-db+get-29311@lists.php.net to get a copy of this message
Hello all, I've been able to get the below to work pretty much. The only problem I have is when there is an apostrophe in the data of one of the fields like (You're the One). When this occurs nothing gets updated or inserted(tried both). I've done other things from forms inserting/updating with data that contained apostrophes and never had a problem. This is my first attempt at inserting/updating from a string match. Any help would be appreciated. $grab = preg_match_all("/(<([\w]+)[^>]*>)(.*)(<\/\\2>)/", $file, $matches); $a_1 = $matches[3][48]; $a_2 = $matches[3][49]; $a_3 = $matches[3][50]; $sql = "UPDATE charts SET artist='$a_1' , song='$a_2' , label='$a_3' WHERE charts_id=1" or die(mysql_error()); if ($result = mysql_query($sql)){ Here is my table structure: charts_id(tinyint(3),NOT NULL) artist(varchar(150),NULL) song(varchar(100),NULL) label(varchar(75),NULL) Thanks in advance, Mike

« previous php.db (#29311) next »