我正在设置一个HTML表单,该表单会将数据插入到MySQL表中,但是它始终会给我500错误。
我尝试了多个调试站点,这些站点指出了错误,并且唯一一个出错的地方是关于安装php mysqli的信息,这必须是该网站的安全性。
<?php
//Connecting to the database configured in the court app
$link = mysqli_connect("localhost", "wvptszyl_sc", "wvptszyl_sc", "wvptszyl_sc");
//Check the connection of the court system while making the form
if($link === false){
die("Oof. " . mysqli_connect_error());
}
//Escape details for security
$roblox_username = mysqli_real_escape_string($link, $_REQUEST['steam_username']);
$discord_username = mysqli_real_escape_string($link, $_REQUEST['discord_username']);
$reason = mysqli_real_escape_string($link, $_REQUEST['reason']);
$type = mysqli_real_escape_string($link, $_REQUEST['type']);
$evidence = mysqli_real_escape_string($link, $_REQUEST['evidence']);
//Insert the data
$sql = "INSERT INTO sc (steam_username, discord_username, reason, type, evidence) VALUES
('$steam_username', '$discord_username', '$reason', '$type', '$evidence')";
if(mysqli_query($link, $sql)){
echo "Ohhh yeah.";
} else{
echo "lol rekt couldn't execute $sql. " . mysqli_error($link);
}
//Finish things up
mysqli_close($link);
?>
我希望它插入数据并给我成功的回声,但是它什么也没有给我,只会返回错误500。
答案 0 :(得分:0)
我进一步研究了问题,似乎我的文件许可权再次出现。
如果它们不在0755上,将无法正常工作