Formatting a string for entry into MySQL
| From: | James Johnson | Date: | Tue, 23 Sep 2003 04:34:10 +0000 |
| Subject: | Formatting a string for entry into MySQL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-163545@lists.php.net to get a copy of this message | ||
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("$qUpdate<br>"); $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