2012-03-05 35 views
0

我正在创建一个表单,以便将数据追加到XML数据库中,该数据库正由另一页上的小部件读取。我需要的数据是在格式如下:使用带尖括号和引号的fwrite

<event start="1914" end="1918" isDuration="true" title="World War I" color="red"> 
Lots of guns and death. 
</event> 

但是,我不知道如何使用PHP的fwrite的功能做的,因为使用尖括号和引号的这一点。例如,我试过如下:

fwrite($database, <event start="$startdate" end="$enddate" 
isDuration="$isDuration" title="$title" color="$color"> 
$description 
</event>); 

但是,这并不工作,我得到意想不到的角度支架等错误,如果有人可以帮助我将不胜感激。

回答

0
fwrite($database, "<event start=\"{$startdate}\" end=\"{$enddate}\" isDuration=\"{$isDuration}\" title=\"{$title}\" color=\"{$color}\"> {$description} </event>");