rash44
دوشنبه 28 بهمن 1387, 11:13 صبح
سلام
من می خوام 1 فرم داشته باشم که بتونم از طریق اون 1 عکس رو توی دیتابیس ذخیره کنم .
کد صفحه HTML :
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Picture</title>
</head>
<body>
<table border="0" width="100%" id="table1" cellspacing="0" cellpadding="0">
<form method="POST" enctype="multipart/form-data" action="reg.php">
<tr>
<td width="67">Picture :</td>
<td> <input type="file" name="pic" size="20"></td>
</tr>
<tr>
<td width="67"> </td>
<td>
<p align="center"><input type="submit" value="Submit" name="B1"></td>
</tr>
</form>
</table>
</body>
</html>
کد پی اچ پی :
<?php
require_once('config.php');
$pic=$_POST['pic'];
$db = db_connect();
$query = "INSERT INTO pic(pic) VALUES ('$pic')";
$result = db_query($query);
if ($result)
{
echo "Ok"; }
else { echo "no"; }
?>
بانک اطلاعاتی :
CREATE TABLE `pic` (
`pic` varchar(255) NOT NULL default 'nopic.gif'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
این کد هیچ error نمی ده اما فیلد دیتا بیس خالیه و مثل اینه که NULL توی دیتابیس ذخیره میشه .
لطفا راهنمائی کنید .
اگر من بخوام عکسی رو که توی دیتا بیس ذخیره هست توی 1 صفحه نمایش بدم باید چکار کنم ؟
لطفا راهنمائی کنید
من می خوام 1 فرم داشته باشم که بتونم از طریق اون 1 عکس رو توی دیتابیس ذخیره کنم .
کد صفحه HTML :
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Picture</title>
</head>
<body>
<table border="0" width="100%" id="table1" cellspacing="0" cellpadding="0">
<form method="POST" enctype="multipart/form-data" action="reg.php">
<tr>
<td width="67">Picture :</td>
<td> <input type="file" name="pic" size="20"></td>
</tr>
<tr>
<td width="67"> </td>
<td>
<p align="center"><input type="submit" value="Submit" name="B1"></td>
</tr>
</form>
</table>
</body>
</html>
کد پی اچ پی :
<?php
require_once('config.php');
$pic=$_POST['pic'];
$db = db_connect();
$query = "INSERT INTO pic(pic) VALUES ('$pic')";
$result = db_query($query);
if ($result)
{
echo "Ok"; }
else { echo "no"; }
?>
بانک اطلاعاتی :
CREATE TABLE `pic` (
`pic` varchar(255) NOT NULL default 'nopic.gif'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
این کد هیچ error نمی ده اما فیلد دیتا بیس خالیه و مثل اینه که NULL توی دیتابیس ذخیره میشه .
لطفا راهنمائی کنید .
اگر من بخوام عکسی رو که توی دیتا بیس ذخیره هست توی 1 صفحه نمایش بدم باید چکار کنم ؟
لطفا راهنمائی کنید