PHP大号变成SQL
PHP large number into SQL
我正在尝试使用此查询:
$cert= 125125161241261241261;
$cert= $cert + 1;
INSERT into table (column) values ($cert);
然而,当插入完成时。
我得到了 12512516124126124+E17
之类的东西。
我已经将数据类型放入 varchar(max)
并且 var_dump
编辑了我的变量
SQL 服务器 200x。
插入引号 '
$cert= 125125161241261241261;
$query = mysql_query("INSERT INTO table (column) VALUES('".$cert."'");
^^^ ^^^
INSERT QUOTES.
注意 SQL INJECTION
这样使用
$cert= 125125161241261241261;
$sql = "INSERT INTO table (column) VALUES(?)";
$stmt = $dbConnection->prepare($sql);
$stmt->bind_param('s', $cert); -- 's' indicate is a string parameter
$stmt->execute();
我使用了一个 SQL 程序来执行插入并在我的 PHP 插入中使用它,感谢任何试图提供帮助的人。
我正在尝试使用此查询:
$cert= 125125161241261241261;
$cert= $cert + 1;
INSERT into table (column) values ($cert);
然而,当插入完成时。
我得到了 12512516124126124+E17
之类的东西。
我已经将数据类型放入 varchar(max)
并且 var_dump
编辑了我的变量
SQL 服务器 200x。
插入引号 '
$cert= 125125161241261241261;
$query = mysql_query("INSERT INTO table (column) VALUES('".$cert."'");
^^^ ^^^
INSERT QUOTES.
注意 SQL INJECTION
这样使用
$cert= 125125161241261241261;
$sql = "INSERT INTO table (column) VALUES(?)";
$stmt = $dbConnection->prepare($sql);
$stmt->bind_param('s', $cert); -- 's' indicate is a string parameter
$stmt->execute();
我使用了一个 SQL 程序来执行插入并在我的 PHP 插入中使用它,感谢任何试图提供帮助的人。