Monday, 30 September 2013

PHP Variable Displaying - Not sure why?

PHP Variable Displaying - Not sure why?

Ok got the code below working but it keeps displaying the q value at the
top of each page. what do I need to change to stop this happening. I can
see the echo value is that what the problem is if so what should I change
it too in order to prevent value displaying? Many thanks.
// capture referral url
$referringPage = parse_url( $_SERVER['HTTP_REFERER'] );
if ( stristr( $referringPage['host'], 'google.' ) )
{
parse_str( $referringPage['query'], $queryVars );
echo $queryVars['q']; // This is the search term used
}
// general form data insert
$sql="INSERT INTO refer_kws (kwid, keyword, kwdate)
VALUES('','".$queryVars['q']."',now())";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "";
mysql_close($con)

No comments:

Post a Comment