Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
2.7k views
in Q2A Core by
Get the following error:

Notice: Undefined index: all in /homepages/.... on line 18

When submitting to google webmastertools:

Big red cross

Parsing erroron line 4439
We were unable to read your Sitemap. It may contain an entry we are unable to recognize. Please validate your Sitemap before resubmitting.

and..

several times line 7, line 8 not valid xml tag.

Should be about 2000 entries, google just finds 511 of 738 ?

I saw others had similar problems, but no where I found the solution.

I tried the original script by Frerichs, and the other one by sama55.

Any info would be welcome...

Thank You so far

1 Answer

0 votes
by
i've just updated my script to address some bugs:

http://www.morphhome.net/sitemap-generator-fur-question2answer

maybe try it again.
by
No, sadly it now hangs at:

mysql_connect("localhost",QA_MYSQL_USERNAME,QA_MYSQL_PASSWORD);
@mysql_select_db(QA_MYSQL_DATABASE) or die( "Unable to select database");

Result:

Unable to select database

I added to the top of the file: <?php and tried   QA_MYSQL_HOSTNAME instead of localhost, but nothing...
by
Unable to select database

==> try to set your database name in " " instead of QA_MYSQL_DATABASE
by
wait... be back in 2 minutes
by
No still no success, tryied all original values, tried ", tried ', nothing..
by
what I really dont understand, is that it works in Your installation so well, very nice site by the way..
by
i'm not sure if you understand what i mean.
I want you to set your database name in "" so for example:
@mysql_select_db("frageee.de") or die( "Unable to select database");

---

Is your database (mysql) running on the same host as your webpage?
by
Yes, i understand it, but it still does not work. Not as ascii not as utf8, which editor do You use, ill try the same..

And, its a shared hosting 1&1, i never had problems with them, their databases are on other servers, but, i use the same data in the config file, should work ?

And i am using another database table prefix, but it shouldnt be the problem at this point of the script.
by
edited by
Your old code worked until line 17

Notice: Undefined index: all in /homepages/44/12345678/htdocs/yourquestion/sitemap.php on line 17

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /homepages/44/12345678/htdocs/yourquestion/sitemap.php on line 23

I will compare and try to find out something more regarding the first lines..
by
Now, the first mentioned error must have been related to some encoding. Using the first part of Your old code works , I took the old first lines up to

@mysql_select_db(QA_MYSQL_DATABASE) or die( "Unable to select database");

took off error reporting line 6 and added the rest of Your new code.

Now it hangs at line 25

Notice: Undefined index: all in /homepages/44/12345678/htdocs/yourquestion/sitemap.php on line 19

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /homepages/44/12345678/htdocs/yourquestion/sitemap.php on line 25
by
Ok, the nmrow problem was because i had to change my tableprefix in line 21

Now again all entries are listed if i call sitemap.php in the server but the second line still shows:

Notice: Undefined index: all in /homepages/44/12345678/htdocs/yourquestion/sitemap.php on line 19

I will upload the sitemap again now, and be back in 10 minutes with the result
by
Ok, finally it works, google accepted the sitemap and shows all the urls .

There are just 2 details still not perfect:

Line 2 in sitemap.php in browser: Notice: Undefined index: all in /homepages/44/12345678/htdocs/yourquestion/sitemap.php on line 19

And the google  warnings:

Sitemap errors and warnings
Line    Status    Details
    7   
Invalid XML tag
This tag was not recognized. Please fix it and resubmit.   
Parent tag: urlset
Tag: br
Problem detected on: Sep 28, 2010
    8   
Invalid XML tag
This tag was not recognized. Please fix it and resubmit.   
Parent tag: urlset
Tag: b
Problem detected on: Sep 28, 2010
    8   
Invalid XML tag
This tag was not recognized. Please fix it and resubmit.   
Parent tag: urlset
Tag: b
Problem detected on: Sep 28, 2010
    8   
Invalid XML tag
This tag was not recognized. Please fix it and resubmit.   
Parent tag: urlset
Tag: b
Problem detected on: Sep 28, 2010
    8   
Invalid XML tag
This tag was not recognized. Please fix it and resubmit.   
Parent tag: urlset
Tag: br
Problem detected on: Sep 28, 2010

Just for info.

However, thank You so much for this sitemap generator !

Vielen Dank für diesen super SItemap Generator !

For others as inforamtion: Be careful with the Encoding of this script, it must be utf8 , if it does not work try it again.
And if localhost does not work for You, You can use instead
mysql_connect(QA_MYSQL_HOSTNAME,QA_MYSQL_USERNAME,QA_MYSQL_PASSWORD);

and if You use another table-prefix than qa_ You have to change it in line 21  where it says:  qa_posts  in


$query = "select postid, type, parentid, title, content, created from qa_posts where (type = 'Q') order by created desc";
by
Thanks for creating a sitemap plugin!  Looking at the code, I was wondering about a few things.

1) You've hardcoded the date ("lastmod") for the main URL, would it be better to do a lookup for the day when the site was last updated and use that instead?

2) Is there a way to do a query for category and/or tag urls and display those as well?  (And set a priority of say 0.7)

3) If a site isn't super active, is it better to set the check frequency to weekly from daily?
...