我正在使用000webhost运行基本的登录系统。进一步的细节是机密的,但是来自post变量的一些数据被放入SQL字符串中,然后在数据库中运行。
<?php
// connect to database
$dbServerName = "localhost";
$dbUsername = "-----";
$dbPassword = "-----";
$dbName = "-----";
$tableName = "user_info";
$conn = mysqli_connect($dbServerName, $dbUsername, $dbPassword, $dbName);
$sql = "INSERT INTO $tableName ( uid, pwd, type, type_detail, location ) VALUES ( '$uid', '$pwd', '$type', '$type_detail', '$location' );";
echo $sql;
$result = mysqli_query($conn, $sql);
回声给出:
INSERT INTO user_info(uid,pwd,type,type_detail,location)VALUES('_____','_____','_____','_____','_____');
符合预期。
答案 0 :(得分:0)
已解决:
我回声说:
echo mysqli_error($ conn);
它返回:
“'pwd'的数据对于数据字段来说太长了”