不会将项插入表但没有错误 [英] Won't insert item into table but no error

查看:78
本文介绍了不会将项插入表但没有错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想将管理部分中的项目插入我的网店中的表'项目'..

i已插入消息,并在文件夹中获取图片但数据库中没有任何内容...没有错误所以idk有什么不对..

我的代码是简单的查询,



我的表格的图片... atm我想插入'项目'

[ ^ ] - 图片在这里

我还需要做一些连接还是一些东西?请帮助我



我尝试过的事情:



<?php 

$ conn = mysqli_connect('localhost','root','','webshop');


$ cat = $ _ POST ['cat'];
$ subcat = $ _ POST ['subcat'];
$ name = $ _ POST ['name'];
$ brand = $ _ POST ['brand'];
$ img = $ _ FILES ['file'] ['tmp_name'];
$ img = $ _ FILES ['fileone'] ['tmp_name'];
$ price = $ _ POST ['price'];
$ desc = $ _ POST ['description'];

if(isset($ _ POST [submit]))
{
mysqli_query($ conn,insert into items(category,subcategory,name,brand,img,价格,描述)价值('$ cat','$ subcat','$ name','$ brand','$ img','$ price','$ desc'));
{
move_uploaded_file($ _ FILES ['file'] ['tmp_name'],.. / img_items /\".$_ FILES ['file'] ['name']);
move_uploaded_file($ _ FILES ['fileone'] ['tmp_name'],.. / img_items /\".$_ FILES ['fileone'] ['name']);
echo< font size ='+ 2'>项已成功插入< / font>;

}
}
else {

echo抱歉出了问题!!;
}

解决方案

conn = mysqli_connect('localhost','root','','webshop');

猫=

_POST [ '猫'];

i just want to insert item from admin section to table 'items' in my webshop..
i got message that is inserted,and got picture in folder but nothing in database...no erors so idk what is wrong..
my code is simple query ,

pics of my tables...atm i wanna insert into 'items'
[^] - PICTURE HERE
also do i need to do some joins or somethign? pls help me

What I have tried:

<?php

$conn = mysqli_connect('localhost','root','','webshop'); 


$cat=$_POST['cat'];
$subcat=$_POST['subcat'];
$name=$_POST['name'];
$brand=$_POST['brand'];
$img=$_FILES['file']['tmp_name'];
$img=$_FILES['fileone']['tmp_name'];
$price=$_POST['price'];
$desc=$_POST['description'];
 
if (isset($_POST["submit"])) 
 {	 
 mysqli_query($conn,"insert into items ( category, subcategory, name, brand, img, price, description ) values ('$cat', '$subcat', '$name', '$brand','$img','$price','$desc' )" );
	 {  
	    move_uploaded_file($_FILES['file']['tmp_name'],"../img_items/".$_FILES['file']['name']);
	    move_uploaded_file($_FILES['fileone']['tmp_name'],"../img_items/".$_FILES['fileone']['name']);
		echo "<font size='+2'>item inserted successfully</font>";
	    
		}
 }
else {

	echo "Sorry Something went wrong!!";
}

解决方案

conn = mysqli_connect('localhost','root','','webshop');


cat=


_POST['cat'];


这篇关于不会将项插入表但没有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆