I am using this query to insert values, but it is not working.
我正在使用此查询来插入值,但它不起作用。
$sql="INSERT INTO $tbl_name (type, weight, side, size, quantity)
VALUES ($stock_type, $weight, $side,$size,$quantity)";
In Database table 'value type' is varchar for all values
在Database表中,'value type'是所有值的varchar
2 个解决方案
#1
0
I don't know the column types but you need to quote values for string type fields:
我不知道列类型,但您需要引用字符串类型字段的值:
$sql='INSERT INTO $tbl_name (type, weight, side, size, quantity)
VALUES ("$stock_type", "$weight", "$side", "$size" , "$quantity")';
#2
0
If any of those columns are char, varchar or date you need to quote them.
如果这些列中的任何一个是char,varchar或date,则需要引用它们。
$sql="INSERT INTO $tbl_name ( type, weight, side, size, quantity)
VALUES ('$stock_type', $weight, '$side', $size, $quantity)";
#1
0
I don't know the column types but you need to quote values for string type fields:
我不知道列类型,但您需要引用字符串类型字段的值:
$sql='INSERT INTO $tbl_name (type, weight, side, size, quantity)
VALUES ("$stock_type", "$weight", "$side", "$size" , "$quantity")';
#2
0
If any of those columns are char, varchar or date you need to quote them.
如果这些列中的任何一个是char,varchar或date,则需要引用它们。
$sql="INSERT INTO $tbl_name ( type, weight, side, size, quantity)
VALUES ('$stock_type', $weight, '$side', $size, $quantity)";