Link to home
Start Free TrialLog in
Avatar of roberts9
roberts9

asked on

PHP Search Help

Hi,

I would like to build a little search engine in the admin area, and also define the number of search results and display them($results).
I'm calling data from xml feed and then parse it.
Here is the  query:
$url = "http://pf.tradedoubler.com/pf/pf?&keyword=$keywords&maxResults=$max";

$keywords would be the search term
$max would be the number of search returns

and the returned results parsed in:
$result .='<div><a href=\"$producturl\">$producttitle</a><br />$productprice</div>';

Thanks in advance
Avatar of themrrobert
themrrobert
Flag of United States of America image

Show me some example xml data and how you are going to be searching, with sql, php, searching through strings a database, xml pages, xml values and/or fields, or give me your affiliateID.

I can help you out with this no problem. If not through EE, then I have contact info in my profile.
Avatar of roberts9
roberts9

ASKER

themrrobert, Thank you so much for your help

Here is the whole code i'm using:

<?php
$affid="";
$keywords="nikon";
$max=10;

$url = "http://pf.tradedoubler.com/pf/pf?a=$affid&keyword=$keywords&maxResults=$max";
$SafeQuery = urlencode($url);
$xml = simplexml_load_file($SafeQuery);

foreach ($xml->product as $item) {
$productimage = $xml->imageUrl;
$producturl = $xml->productUrl ;
$producttitle = $xml->name;
$productprice = $xml->price ;

$result .='<div><img src=\"$productimage\"><br /><a href=\"$producturl\">$producttitle</a><br />$productprice</div>';

return $result;

?>

 
I  just forgot the } closing tag, before return $result;
I just made a mistake, so i repost the code....i couldn't edit my question
<?php

$affid="";
$keywords="nikon";
$max=10;

$url = "http://pf.tradedoubler.com/pf/pf?a=$affid&keyword=$keywords&maxResults=$max";
$SafeQuery = urlencode($url);
$xml = simplexml_load_file($SafeQuery);

foreach ($xml->product as $item) {
$productimage = $item->imageUrl;
$producturl = $item->productUrl ;
$producttitle = $item->name;
$productprice = $item->price ;

$result .='<div><img src=\"$productimage\"><br /><a href=\"$producturl\">$producttitle</a><br />$productprice</div>';

}
return $result;

?>
ASKER CERTIFIED SOLUTION
Avatar of themrrobert
themrrobert
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial