RE: [PHP] Formatting a string for entry into MySQL
| From: | James Johnson | Date: | Tue, 23 Sep 2003 15:19:31 +0000 |
| Subject: | RE: [PHP] Formatting a string for entry into MySQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-163593@lists.php.net to get a copy of this message | ||
Ok, thanks. It took a little bit of experimenting with printf(), sprintf()
and quotes, but I got it to work.
mysql_select_db($database_CCB, $CCB);
$ad_contact = "who@what.com<br>909-555-1212";
$esAdContact = mysql_escape_string($ad_contact);
$q = sprintf("UPDATE subscriber_ads SET ad_contact = '%s' WHERE subid = 43",
$esAdContact);
$r = mysql_query($q, $CCB) or print(mysql_error());
Thanks,
James
-----Original Message-----
From: Burhan Khalid [mailto:phplist@meidomus.com]
Sent: Tuesday, September 23, 2003 4:45 AM
To: James Johnson; php-general@lists.php.net
Subject: Re: [PHP] Formatting a string for entry into MySQL
James Johnson wrote:
> Hi,
>
> I'm trying to generate a string that contains a <br>, to insert into a
> MySQL table. It appears the <br> is being stripped out either just
> before or during the update.
http://www.php.net/mysql-escape-string
--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php