Reply to Re: echoing url to xml output

Your name:

Reply:


Posted by Erwin Moller on 12/19/07 17:04

it@brewers.co.uk wrote:
> Hi

Hi,

> I am creating an XML output using php but get a error because the data
> in the description field is outputing a link which is: <a HREF="HTTP://
> WWW.PASTETHEWALL.CO.UK">Paste the wall</A>.

You get an error.
What error?
Where?
In PHP or with the xml-output when you try to parse it somewhere else?

A blind guess would be: You get an error in the produced XML, since it
produces:

<product id="'.$row['description'].'">

which gives:

<product id="<a HREF="HTTP://WWW.PASTETHEWALL.CO.UK">Paste the wall</A>">

That doesn't make a lot of sense.
It is a very strange id: "<a HREF="

Then follows immediately:
HTTP://WWW.PASTETHEWALL.CO.UK">Paste the wall</A>"

I don't know the first thing about XML, but I expect this to be nonsense.

If an id in XML is anything like an id in html, it cannot contain
spaces, or <

Regards,
Erwin Moller

>
> Below is the script I'm using, new to php and not sure how to get
> round this hope someone can help. Thanks in advance..........
>
> <?php
> $dbhost = '';
> $dbuser = '';
> $dbpass = '';
> $dbname = '';
> mysql_connect($dbhost, $dbuser, $dbpass) or die("I could not connect
> to database");
> mysql_select_db($dbname) or die (mysql_error());
> header('Content-type: text/xml');
> echo '<?xml version=\'1.0\' encoding=\'UTF-8\'?>';
> echo '
> <products xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:nonamespaceschemalocation="schema">';
> // Start the XML
> $data = mysql_query("select * from products ORDER BY description");
> while($row = mysql_fetch_array($data))
> {
> echo '
> <product id="'.$row['description'].'">
> </product>';
> }
> echo '
> </products>';
> ?>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация