我如何解决此错误。
”此页面无法正常运行sample.com当前无法处理此请求。 HTTP错误500
这是我的文件
<?php
$uname=$_GET['uname'];
$pwd=$_GET['pwd'];
$num=$_GET['num'];
$email=$_GET['email'];
$re_pwd=$_GET['re_pwd'];
echo $uname;
$conn=mysql_connect("localhost","test_prgram","test123","test_program");
if($conn==true)
{
echo "connection successfully";
$query=mysqli_query("insert into user values ( ".$uname.",".$num.",".$email.",".$pwd",".$re_pwd.")");
mysqli_execute($query);
}
else
{
echo "error";
}
$mysql_close();
?>
答案 0 :(得分:1)
您应在mysqli_query
替换
insert into user values ( ".$uname.","....
使用
insert into user values ( '".$uname."','"....
以此类推
但是,如评论中所述,您应该使用更合适的查询方法,称为prepared statement
https://www.tutorialrepublic.com/php-tutorial/php-mysql-prepared-statements.php
答案 1 :(得分:0)
在pwd和re_pwd之间的连接中可能只是缺失的点(。)
.$email.",".$pwd",".$re_pwd