Re: [PHP] Formatting a string for entry into MySQL

2003-09-23 Thread Burhan Khalid
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


RE: [PHP] Formatting a string for entry into MySQL

2003-09-23 Thread James Johnson
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 = [EMAIL PROTECTED]br909-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:[EMAIL PROTECTED] 
Sent: Tuesday, September 23, 2003 4:45 AM
To: James Johnson; [EMAIL PROTECTED]
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

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



[PHP] Formatting a string for entry into MySQL

2003-09-22 Thread James Johnson
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.

** code **
// has both info, update both
$ad_contact = $tr_email;
$ad_contact .= br;  
$pSep = -;
$ad_contact .= $tr_p1AC;
$ad_contact .= $pSep;
$ad_contact .= $tr_p1PRE;
$ad_contact .= $pSep;
$ad_contact .= $tr_p1SUF;

// update the record
$qUpdate = UPDATE subscriber_ads SET ad_contact = '$ad_contact' WHERE subid
= $sid; print($qUpdatebr); $rUpdate = mysql_query($qUpdate, $CCB) or
die(mysql_error());

The print() statement shows the correct format in the browser. I've looked
at printf() and sprintf(), but can't quite figure the syntax.

I want the br in the string so it will output correctly in the browser
when that data is retrieved from the DB.

Suggestions?

Thanks,
James

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