请帮我调试下面用php编写的代码。 127.0.0.1目前无法处理此请求。
这是php脚本
<?php
require "init.php";
$user_name = "shiko123";
$user_pass = "shiko@321";
$sql_query = "select name from user_info where user_name like '$user_name'and user_pass like '$user_pass';";
$result = mysqli_query($conn,$sql_query);
if(mysqli_num_rows($result) > 0)
{
$row = mysqli_fetch_assoc($result);
$name = $row["name"];
echo "<h3> Welcome".$name"</h3>";
}
else
{
echo "No information available";
}
?>
答案 0 :(得分:1)
使用else
关闭}
。它应该是这样的
<?php
require "init.php";
$user_name = "shiko123";
$user_pass = "shiko@321";
$sql_query = "select name from user_info where user_name like '$user_name'and user_pass like '$user_pass';";
$result = mysqli_query($conn,$sql_query);
if(mysqli_num_rows($result) > 0)
{
$row = mysqli_fetch_assoc($result);
$name = $row["name"];
echo "<h3> Welcome".$name"</h3>";
}
else
{
echo "No information available";
}
?>
&#13;