RE: Insert/Update help needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mike,

Pretty sure your solution is to addslashes() around whatever data might
contain the apostrophes.

HTH,
Rich

> -----Original Message-----
> From: Mike Baerwolf [mailto:mike@wkla.com]
> Sent: Thursday, July 17, 2003 11:33 AM
> To: php-db@lists.php.net
> Subject:  Insert/Update help needed
> 
> 
> 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
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux