<form action="insert_pro.php" method="post" enctype="multipart/form-data">
<div class="center_content">
<div class="title_box">insert new product</div>
<div class="prod_box_big">
<div class="center_prod_box_big">
<div class="product_img_big"> <!-- <a href="javascript:popimage('images/big_pic.jpg','some title')" title="header=[zoom] body=[ ] fade=[on]"><img src="images/p3.jpg" alt="" border="0" /></a> -->
</div>
<div class="details_big_box">
<!-- title -->
<div class="product_title_big" >product title :</div>
<td><input type="text" name="title" required/></td>
<!-- description -->
<div class="product_title_big">description : </div>
<td><textarea name="descrip" cols="21" rows="5"/></textarea></td>
<!-- price -->
<div class="product_title_big">price :</div>
<td><input type="text" name="price" required/></td>
<!-- photo -->
<div class="product_title_big">product photo :</div>
<td><input type="file" name="way" required/></td>
<!-- note -->
<h1>if you finished filling information of the product click add product</h1>
</div>
<!-- button -->
<input type="submit" name="insert_post" value="add product">
</div>
</div>
</div>
</form>
<?php
if(isset($_post['insert_post'])){
$title = $_post['title'];
$descrip = $_post['descrip'];
$price = $_post['price'];
$way = $_files['way']['name'];
$way_tmp = $_files['way']['tmp_name'];
move_uploaded_file($way_tmp, "prod/$way");
$insert_product = " insert into product (title,descrip,price,way) values ('$title','$descrip','$price','$way')";
}
?>
yukarıdaki form aşağıdaki database veri gönderiyorum olmuyor.
include pro/db.php
db.php içi :
<?php
// $con = mysql_connect("localhost","root","3306505","shop");
$baglan = mysql_connect('localhost','root','3306505');
$dbsec = mysql_select_db('shop');
mysql_query("set character set utf8");
?>
<div class="center_content">
<div class="title_box">insert new product</div>
<div class="prod_box_big">
<div class="center_prod_box_big">
<div class="product_img_big"> <!-- <a href="javascript:popimage('images/big_pic.jpg','some title')" title="header=[zoom] body=[ ] fade=[on]"><img src="images/p3.jpg" alt="" border="0" /></a> -->
</div>
<div class="details_big_box">
<!-- title -->
<div class="product_title_big" >product title :</div>
<td><input type="text" name="title" required/></td>
<!-- description -->
<div class="product_title_big">description : </div>
<td><textarea name="descrip" cols="21" rows="5"/></textarea></td>
<!-- price -->
<div class="product_title_big">price :</div>
<td><input type="text" name="price" required/></td>
<!-- photo -->
<div class="product_title_big">product photo :</div>
<td><input type="file" name="way" required/></td>
<!-- note -->
<h1>if you finished filling information of the product click add product</h1>
</div>
<!-- button -->
<input type="submit" name="insert_post" value="add product">
</div>
</div>
</div>
</form>
<?php
if(isset($_post['insert_post'])){
$title = $_post['title'];
$descrip = $_post['descrip'];
$price = $_post['price'];
$way = $_files['way']['name'];
$way_tmp = $_files['way']['tmp_name'];
move_uploaded_file($way_tmp, "prod/$way");
$insert_product = " insert into product (title,descrip,price,way) values ('$title','$descrip','$price','$way')";
}
?>
yukarıdaki form aşağıdaki database veri gönderiyorum olmuyor.
include pro/db.php
db.php içi :
<?php
// $con = mysql_connect("localhost","root","3306505","shop");
$baglan = mysql_connect('localhost','root','3306505');
$dbsec = mysql_select_db('shop');
mysql_query("set character set utf8");
?>

oluşturduğun mysql query'sini "mysql_query($insert_product);" şeklinde çağırman lazım.
...
$insert_product = " INSERT INTO product (title,descrip,price,way) values ('$title','$descrip','$price','$way')";
mysql_query($insert_product);
...
şeklinde çalışıyor bende.
edy


yol yakınken mysql_ komutlarını bırak, yapacaksan mysqli yap; ama pdo ogren en temizi o.
sql injection diye bi nane var biliyorsun.
sage

1