Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将信息从xslt传递到mysql_Mysql_Xml_Xslt_Xslt 1.0 - Fatal编程技术网

如何将信息从xslt传递到mysql

如何将信息从xslt传递到mysql,mysql,xml,xslt,xslt-1.0,Mysql,Xml,Xslt,Xslt 1.0,我需要知道如何将我的xsl转换链接到我的数据库我目前让它进行html转换,但需要将数据插入数据库xslt是一个单独的文件,仅用于转换,并在php脚本中运行,几天前我在上面看到了一条线,但忘了保存它,现在我找不到这上面的任何东西。xml是一个提要而不是一个文件这是xsl的外观: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999

我需要知道如何将我的xsl转换链接到我的数据库我目前让它进行html转换,但需要将数据插入数据库xslt是一个单独的文件,仅用于转换,并在php脚本中运行,几天前我在上面看到了一条线,但忘了保存它,现在我找不到这上面的任何东西。xml是一个提要而不是一个文件这是xsl的外观:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:variable name="ref" select="lr_rates/hoel_ref"/>
     <xsl:for-each select="//room">
      <xsl:variable name="ref" select="ref"/>
      <xsl:variable name="type" select="type_description"/>
      <xsl:variable name="descr" select="description"/>
      <xsl:variable name="avail" select="rooms_available"/>
      <xsl:variable name="rate" select="rack_rate"/>
      <xsl:variable name="cur" select="rate/requested_currency"/>
    </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

我想我可能需要一个mysql_connect语句,而不仅仅是一个应用程序,只要有人能链接到一个好的解释,它就是一个php脚本中的单个xsl,XSLT就是一个XML转换,这意味着你可以将任何XML文件从XML转换成你能想到的任何其他基于文本的格式。如果没有某种处理代码来获取结果并执行查询,它不会神奇地与数据库交互。因为您需要这个,并且提到了PHP,所以最好首先在PHP中处理XML,并以这种方式填充数据库

 "DELETE FROM `pt_rooms` WHERE hotel_ref = '$id'";
 "INSERT INTO `pt_rooms`(hotel_ref,room_ref,room_type,description,availability,price,currency) VALUES ('$id','$ref','$type','$descr','$avail','$rate','$cur')";