hi
i'm pretty new to php. so let me ask you a pretty easy question:
the code below is supposed to import an image to a mssql database.
images are not meant to be stored in databases, i know. anyway, i'm
wondering why my code doesn't work.
can anybody give me some help?
regards
<HTML>
<HEAD>
<TITLE>php test</TITLE>
</HEAD>
<?php
$db = mssql_connect(" xxx","xxx","xxx ") or die("Can't connect to
mssql server.");
mssql_select_db ("xxx", $db) or die("Can't select database.");
$name="51_DRAWI NG.jpg";
$type="image/pjpeg";
$file = fopen("C:/Temp/51_DRAWING_2.jp g", "r");
$filesize = filesize("C:/Temp/51_DRAWING_2.jp g");
$sql="INSERT INTO images(ID_IMAGE ,ID_GCP,ID_LEVE L_IMG,IMAGE_BIN ,IMAGE_NAME,IMA GE_SIZE,IMAGE_T YPE)";
$sql .=" VALUES('503','5 1','4','$img',' $name','$filesi ze','$type')";
$result=mssql_q uery($sql);
?>
</HTML>
i'm pretty new to php. so let me ask you a pretty easy question:
the code below is supposed to import an image to a mssql database.
images are not meant to be stored in databases, i know. anyway, i'm
wondering why my code doesn't work.
can anybody give me some help?
regards
<HTML>
<HEAD>
<TITLE>php test</TITLE>
</HEAD>
<?php
$db = mssql_connect(" xxx","xxx","xxx ") or die("Can't connect to
mssql server.");
mssql_select_db ("xxx", $db) or die("Can't select database.");
$name="51_DRAWI NG.jpg";
$type="image/pjpeg";
$file = fopen("C:/Temp/51_DRAWING_2.jp g", "r");
$filesize = filesize("C:/Temp/51_DRAWING_2.jp g");
$sql="INSERT INTO images(ID_IMAGE ,ID_GCP,ID_LEVE L_IMG,IMAGE_BIN ,IMAGE_NAME,IMA GE_SIZE,IMAGE_T YPE)";
$sql .=" VALUES('503','5 1','4','$img',' $name','$filesi ze','$type')";
$result=mssql_q uery($sql);
?>
</HTML>
Comment