Jump to content

[SOLVED] Strip quotes


rondog

Recommended Posts

Hi I am creating an XML file with PHP but some of the entries in the DB have " marks (quotation marks) and is truncating the XML. Is their a way to not include quotes when I am selecting from the DB...this is what I have right now:

<?php
include 'mssqlconnect.php';

$state = $_POST['state'];
//$state = "NJ";

if($state != "") {
$query = mssql_query("SELECT * FROM DE_Events WHERE state = '$state' AND displayOnSite = 'true'") or die(mssql_get_last_message());
} else {
$query = mssql_query("SELECT * FROM DE_Events WHERE displayOnSite = 'true'") or die(mssql_get_last_message());
}

$build = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$build .= "<events>\n";
while($row = mssql_fetch_array($query)) {
$build .= "\t<item date=\"$row[event_date]\" starthour=\"$row[start_hour]\" start_minute=\"$row[start_minute]\" startampm=\"$row[start_ampm]\" endhour=\"$row[end_hour]\" endminute=\"$row[end_minute]\" endampm=\"$row[end_ampm]\" name=\"$row[name]\" location=\"$row[location]\" address=\"$row[address]\" city=\"$row[city]\" state=\"$row[state]\" zip=\"$row[zip]\" phone=\"$row[phone]\" description=\"$row[description]\" />\n";
}
$build .= "</events>";
echo $build;
?>

Link to comment
https://forums.phpfreaks.com/topic/100254-solved-strip-quotes/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.