Re: calling a function in the same page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jahangir wrote:
I am trying to call a function from "a href" inside the same page.
this is the code:
echo "<br><br><a href=\"isearch($query)\">More results from Mysite</a>";
// calling the function isearch

function isearch($query)

{$query=urlencode($query);

$request='http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=Ja
hangir&query=' .urlencode($query). '&output=php&results=100&site=mysite.com;

$response=file_get_contents($request);

if ($response === false) {

die('Request failed');}

$phpobj=unserialize($response);

$count=$phpobj["ResultSet"]["totalResultsReturned"];

if($phpobj["ResultSet"]["totalResultsAvailable"]==0)

{echo "<br>NO RESULTS TO DISPLAY"; }

add a 'die;' here.. like

{
echo "<br>NO RESULTS TO DISPLAY";
die;
}

--
Thanking You

Sumeet Shroff
http://www.prateeksha.com
Web Designers and PHP / Mysql Ecommerce Development, Mumbai India

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux