function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$db_link = mysql_connect("localhost", "root", "");
if (!$db_link) {
die("Could not connect: " . mysql_error());
}
mysql_select_db("emre42") or die("Could not select database");
$data=file_get_contents('http://www.google.com');
$site="www.google.com";
$ekleme=mysql_query(sprintf("INSERT INTO beyefendi
(site, icerik) VALUES(%s, %s)", GetSQLValueString($site, "text"), GetSQLValueString($data, "text"))) or die(mysql_error());
?>