我的这段代码有点问题。当我运行它时,它不会在数据库中创建任何值并显示。解析错误:语法错误,第 8 行 /home/vol6_8/epizy.com/epiz_23744660/htdocs/main/test.php 中的意外“INSERT”(T_STRING)这是我的代码:include("config.php);// Create connection$conn = new mysqli($dbhost, $dbuser, $dbpasswd, $dbname);// prepare and bind$stmt = $conn->prepare("INSERT INTO phpbb_crany ('crany_id', 'crany_name', 'crany_breed', 'crany_gender', 'crany_level', 'crany_born', 'crany_mother', 'crany_father', 'crany_element', 'crany_user') VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");$stmt->bind_param("ssssssssss",1, $cn, $cb, $cg, $cl, $cb, $cm, $cf, $ce, $cu);// set parameters and execute$cn = $_POST['petname'];$cb = "jgh";$cg = rand(0,1);$cl = "1";$cb = $_SERVER['REQUEST_TIME'];$cm = 0;$cf = 0;$ce = 1;$cu = 1;$stmt->execute();echo "New records created successfully";$stmt->close();$conn->close();我正在尝试使用 php 和 mysql。有什么问题吗?
1 回答
- 1 回答
- 0 关注
- 138 浏览
添加回答
举报
0/150
提交
取消