I am following this tutorial step by step http://code.google.com/apis/maps/articles/phpsqlajax.html . Actually I copy pasted the code and created the database, added the data to the table, downloaded the provided php and html files but when i actually try to run the page that will create the xml file i get this error. Can anyone guess what is wrong? I am using XAMPP 1.7.4 [PHP: 5.3.5]
我正在逐步学习本教程http://code.google.com/apis/maps/articles/phpsqlajax.html。实际上我复制粘贴代码并创建数据库,将数据添加到表中,下载提供的php和html文件,但是当我实际尝试运行将创建xml文件的页面时,我收到此错误。谁能猜出有什么不对?我正在使用XAMPP 1.7.4 [PHP:5.3.5]
(The google tutorial suggests 3 ways to generate the xml file. I tried all 3 of them and the same error appears on the first 2 and an "error on line 10" (which is the line that php script begins) appears when i try the 3rd suggested way. I am thinking if this wont work to use mysqldump command in order to export the xml file i need.)
(谷歌教程建议3种方法来生成xml文件。我尝试了所有3个方法,并且在前2个上出现相同的错误,并且当我尝试时出现“第10行的错误”(这是php脚本开始的行)第三种建议的方式。我在想如果使用mysqldump命令导出我需要的xml文件是不行的。)
2 个解决方案
#1
0
-EDIT-
Problem was in the connection to the database, value for $host and/or $user and/or $pass was incorrect or not provided.
-EDIT-问题在于与数据库的连接,$ host和/或$ user和/或$ pass的值不正确或未提供。
If you use version 2 (phpsqlajax_genxml2), edit the file at line 15
replacing localhost
with 'localhost'
.
如果使用版本2(phpsqlajax_genxml2),请在第15行编辑文件,将localhost替换为“localhost”。
If you use version 3 (phpsqlajax_genxml3), edit the file at line 13
replacing localhost
with 'localhost'
.
如果您使用版本3(phpsqlajax_genxml3),请在第13行编辑文件,将localhost与'localhost'一起使用。
Then try again.
然后再试一次。
#2
1
You have two root elements in your XHTML: html
and markers
. This is why your browser correctly considers it to be invalid.
您的XHTML中有两个根元素:html和markers。这就是您的浏览器正确认为它无效的原因。
The problem with blindly copying/pasting code is that when you come across a problem it's very difficult to solve, because you don't understand what the code is doing. I suggest you read through the code closely. When you understand it, you'll be able to fix it.
盲目复制/粘贴代码的问题是当遇到问题时很难解决,因为你不明白代码在做什么。我建议你仔细阅读代码。当你理解它,你就能解决它。
Essentially you'll want to remove all of the output up until the <markers>
tag. Perhaps the HTML file you're using is incorrect.
基本上你要删除
#1
0
-EDIT-
Problem was in the connection to the database, value for $host and/or $user and/or $pass was incorrect or not provided.
-EDIT-问题在于与数据库的连接,$ host和/或$ user和/或$ pass的值不正确或未提供。
If you use version 2 (phpsqlajax_genxml2), edit the file at line 15
replacing localhost
with 'localhost'
.
如果使用版本2(phpsqlajax_genxml2),请在第15行编辑文件,将localhost替换为“localhost”。
If you use version 3 (phpsqlajax_genxml3), edit the file at line 13
replacing localhost
with 'localhost'
.
如果您使用版本3(phpsqlajax_genxml3),请在第13行编辑文件,将localhost与'localhost'一起使用。
Then try again.
然后再试一次。
#2
1
You have two root elements in your XHTML: html
and markers
. This is why your browser correctly considers it to be invalid.
您的XHTML中有两个根元素:html和markers。这就是您的浏览器正确认为它无效的原因。
The problem with blindly copying/pasting code is that when you come across a problem it's very difficult to solve, because you don't understand what the code is doing. I suggest you read through the code closely. When you understand it, you'll be able to fix it.
盲目复制/粘贴代码的问题是当遇到问题时很难解决,因为你不明白代码在做什么。我建议你仔细阅读代码。当你理解它,你就能解决它。
Essentially you'll want to remove all of the output up until the <markers>
tag. Perhaps the HTML file you're using is incorrect.
基本上你要删除