0

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]

(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.) enter image description here enter image description here

4
  • I don't know much about this, but could the fact that you have declared the content type to be text/html be the problem? Commented Sep 22, 2011 at 23:55
  • 1
    You clearly didn't follow the tutorial correctly, otherwise you'd have only <markers>...</markers> as your output. Commented Sep 22, 2011 at 23:57
  • Well i just copy pasted the provided code. I dont know why there is an html part above <markers> Commented Sep 23, 2011 at 0:03
  • gonna try it and see if I can get it to work Commented Sep 23, 2011 at 0:12

2 Answers 2

1

You have two root elements in your XHTML: html and markers. This is why your browser correctly considers it to be invalid.

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.

Sign up to request clarification or add additional context in comments.

3 Comments

there is no obvious problem. It is copy paste from google tutorial.
Include the page source in your question.
i posted a print screen of the source
0

-EDIT-
Problem was in the connection to the database, value for $host and/or $user and/or $pass was incorrect or not provided.


If you use version 2 (phpsqlajax_genxml2), edit the file at line 15 replacing localhost with 'localhost'.

If you use version 3 (phpsqlajax_genxml3), edit the file at line 13replacing localhost with 'localhost'.

Then try again.

8 Comments

weird I was getting the same error but that fixed it for me, gonna try find something else.
Nothing changed... I cant explain how html is created out of nothing.
You know, on your screenshot it says undefined localhost bla bla.., could you post a screenshot of what it says after you replace localhost for 'localhost'.
I edited the screenshot. Is there a chance that it is apache's fault?
You know, I have no idea, I reduced the script to try and find the culprit but it still seems like it's the connection line to me, could you try the following: gist.github.com/1236521 and tell me if you can get an xml without un-commenting anything? if not I give up :S
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.