I want to set Location to $link
, but still, in the following code, I'm getting an error saying: Catchable fatal error: Object of class stdClass could not be converted to string
Here is my code:
<?php
$site_id=$_GET['site_id'];
$conn=mysql_connect("localhost","root","") or die("couldn't connect to database") ;
$db=mysql_select_db("search_engine",$conn);
$value=mysql_query("UPDATE sites set rank=(rank+1) WHERE site_id='$site_id'");
$query = "SELECT site_link FROM sites WHERE site_id='$site_id' limit 1";
$result=mysql_query($query);
$value=mysql_fetch_object($result);
$link=(string)$value;
header("Location:".$link);
?>