/    Sign up×
Community /Pin to ProfileBookmark

Alternative method to pass variables through an XML file

Hi everyone.

I am trying to write an Javascript live search engine.

I found this simple program on the w3 website:
[url]http://www.w3schools.com/php/php_ajax_livesearch.asp[/url]
It is an AJAX search engine where all of the results are stored in an XML file.

I would like it to basically load my results from my MySQL database, but you can’t pass PHP variables through an XML document.

I tried this (and it didn’t work):

[CODE]<pages>
<link>
<title><?php echo $row[‘title’]; ?></title>
<url><?php echo $row[‘url’]; ?></url>
</link>
[/CODE]

I also tried:

[CODE]
<?php echo ”
<pages>
<link>
<title>”.row[‘title’].”</title>
<url>”.row[‘url’].”</url>
</link>
</pages>”; ?>
[/CODE]

It just prints the php phrase but won’t echo the string.

Is there a way or alternative to do this?

Thanks
Peter

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @pedro93 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...